fix modal autofocus problem, datepicker not shown on begin date (#653)
This commit is contained in:
@@ -111,9 +111,6 @@ class TimesheetEditForm extends AbstractType
|
||||
'label' => 'label.begin',
|
||||
'model_timezone' => $timezone,
|
||||
'view_timezone' => $timezone,
|
||||
'attr' => [
|
||||
'autofocus' => 'autofocus',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,15 +58,20 @@ class DateTimePickerType extends AbstractType
|
||||
'with_seconds' => false,
|
||||
'model_timezone' => $timezone,
|
||||
'view_timezone' => $timezone,
|
||||
'autofocus' => false,
|
||||
]);
|
||||
|
||||
$resolver->setDefault('attr', function (Options $options) {
|
||||
return [
|
||||
$values = [
|
||||
'data-datetimepicker' => 'on',
|
||||
'autocomplete' => 'off',
|
||||
'placeholder' => $options['format'],
|
||||
'data-format' => $options['format_picker'],
|
||||
];
|
||||
if ($options['autofocus']) {
|
||||
$values['autofocus'] = 'autofocus';
|
||||
}
|
||||
return $values;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user