You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem seems to be the use of required. validator.w3.org gives me this error:
A select element with a required attribute and without a multiple attribute, and whose size is 1, must have a child option element.
This article explains it; from my understanding, I think the problem is that if there is no possible way to select "nothing" (e.g. no option with a blank value), then it's not valid to specify required. In effect, the field is already required because the UI forces a selection.
I think TimeZoneType should generate HTML without "required", but still check for a value server-side (unless the form type is created with 'required' => false of course).
The text was updated successfully, but these errors were encountered:
This PR was merged into the 2.3 branch.
Discussion
----------
[Form] Fixed: "required" attribute is not added to <select> tag if no empty value
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #8942
| License | MIT
| Doc PR | -
Commits
-------
a273e79 [Form] Fixed: "required" attribute is not added to <select> tag if no empty value
Not sure if this only affects
TimeZoneType
, or other use cases ofChoiceType
, but the following code:is creating HTML like the following (cut and reformatted):
The problem seems to be the use of required. validator.w3.org gives me this error:
This article explains it; from my understanding, I think the problem is that if there is no possible way to select "nothing" (e.g. no option with a blank value), then it's not valid to specify required. In effect, the field is already required because the UI forces a selection.
I think TimeZoneType should generate HTML without "required", but still check for a value server-side (unless the form type is created with
'required' => false
of course).The text was updated successfully, but these errors were encountered: