-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Form] The html5 option doesn't work as expected for DateTime types #16600
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
Comments
Can confirm, setting html5 to true is not enough to show the html5 widget for me either. I had to have 'single_text' to display the the html5 widget, which worked without html5 set to true. And when I look at the options passed to DateType, it defaults to html5 = true without me setting it, therefore 'single_text' is enough. |
I also confirm that I need to use I think we need to update the documentation because the wording is incomplete. For the 3 types that I have stated, it should be indicated that it is necessary to use What do you think ? If you affirm I can create a PR. |
@mdoutreluingne Yes, that looks correct to me. |
@xabbuh do you think we could improve the code of these Form types to simplify all this? Maybe using |
@javiereguiluz That sounds like a good idea to me. |
…f date/time form types (MrYamous, nicolas-grekas) This PR was merged into the 6.3 branch. Discussion ---------- [Form] Deprecate not configuring the "widget" option of date/time form types | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Related to a suggestion made on symfony/symfony-docs#16600 | License | MIT | Doc PR | TODO This PR proposes to change the default value of the `widget` option of date/time form types to `single_text`, so that the corresponding input fields are rendered using native HTML5 widgets by default. It does so by deprecating *not* setting the `widget` option, so that we can change the default in Symfony 7. Commits ------- 1ca33e7 [Form] Fix deprecation layer f4348ea deprecate not configuring widget option for DateType, DateTimeType, TimeType
Fixed in symfony/symfony#49588 |
In this page: https://symfony.com/doc/4.4/reference/forms/types/date.html#html5
We say that adding
['html5' => true]
is enough to display a native browser widget to pick dates.I can't make it work. I need to use
['html5' => true, 'widget' => 'single_text']
to render those native widgets.Am I doing something wrong or should we update the docs? Thanks!
The text was updated successfully, but these errors were encountered: