-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Add allow_html5 option to date and time FormType to disable HTML5 input type #8291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👍 |
I think this is related to this #7123 👶 |
@csanquer could you please add this ticket number to the table on the description if it fixes it too? 👶 thanks, ~ cordoval |
done |
@bschussek Can you have a look at this one? |
@fabpot, seems like you've confused @webmozart's nickname :) |
well, three months ago his nickname was @bschussek :) |
@fabpot I rebased the PR on master. I know this PR is quite old but still useful, because the HTML5 date input lacks of real support even in latest browser version and jquery plugin like bootstrap-datetimepicker need an input text. Is there anything wrong that prevent merging I can fix ? |
@@ -93,7 +93,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) | |||
} | |||
|
|||
if ('single_text' === $options['widget']) { | |||
if (self::HTML5_FORMAT === $pattern) { | |||
if ($options['allow_html5'] && self::HTML5_FORMAT === $pattern) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this change. If your format is the HTML5 one, the right transformer should be used even if you don't use the HTML5 type when rendering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hum, i think you're right , this new option allow_html5 is really used to prevent setting view variable type
to HTML5 date, time or datetime,
Changing the data transformer is not really needed when allow_html5
is set to false
.
I fixed the test for initializing the data transformer and i rebased with 8000 squashing over master. It is ready for merge. |
…e input when widget is set to single_text remove unnecessary test when creating datetime format data transformer
👍 |
1 similar comment
👍 |
Thank you @csanquer. |
… to disable HTML5 input type (csanquer) This PR was merged into the 2.6-dev branch. Discussion ---------- [Form] Add allow_html5 option to date and time FormType to disable HTML5 input type [Form] added allow_html5 option to date and time FormType to disable HTML5 input type when widget is set to single_text | Q | A | --------------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #6927 #7123 | License | MIT | Doc PR | With this little patch we can have a single text widget without HTML5 date input type which is required when using some javascript date or time picker . Commits ------- 392d6c7 add allow_html5 option to date and time FormType to disable HTML5 date input when widget is set to single_text
This PR was merged into the 2.6-dev branch. Discussion ---------- [Form] Changed "allow_html5" to "html5" | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This is a follow-up to #8291, which I missed before it was merged. IMO "allow_html5" is a confusing name. We don't "allow" HTML5, but we use it - or we don't. I think "html5" conveys that meaning well and is shorter at the same time. Commits ------- ad171be [Form] Changed "allow_html5" to "html5"
This PR was merged into the 2.6 branch. Discussion ---------- Documented html5 option | Q | A | --- | --- | Doc fix? | no | New docs? | yes (symfony/symfony#8291, symfony/symfony#11994) | Applies to | 2.6+ | Fixed tickets | #4262 Commits ------- d08925e Yet another typo fix 238beef Typo fix 22069f4 Documented html5 option
[Form] added allow_html5 option to date and time FormType to disable HTML5 input type when widget is set to single_text
With this little patch we can have a single text widget without HTML5 date input type which is required when using some javascript date or time picker .