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
Hello,
the last version (2.22.0) fixed bug #1332 that selects the first value of select fields when they are required. This works great, even with placeholders, as they are selected if present, which is the intended behaviour. Unfortunately, due to loose comparison, if there is an empty placeholder (that is, a placeholder defined as the empty string), it is detected as a field without placeholder.
Casting the placeholder to a boolean leads to the empty string being considered as an absence of placeholder, this should be tested this way I think :
$child['placeholder'] === null
To reproduce the bug, try a ChoiceType field that is required, with an empty placeholder (['placeholder => ''] in the options array of the form), and see that it takes the first value when changing another field of the form.
Not a big deal, but I had to investigate why the behaviour was different in the previous version, so I might not be the only one.
The text was updated successfully, but these errors were encountered:
Fix for a bug that arises when using an empty placeholder in a required select field, that is wrongly treated as an absence of placeholder by LiveComponents.
Hello,
the last version (2.22.0) fixed bug #1332 that selects the first value of select fields when they are required. This works great, even with placeholders, as they are selected if present, which is the intended behaviour. Unfortunately, due to loose comparison, if there is an empty placeholder (that is, a placeholder defined as the empty string), it is detected as a field without placeholder.
The error comes from the line here :
ux/src/LiveComponent/src/ComponentWithFormTrait.php
Line 268 in 9d1dada
Casting the placeholder to a boolean leads to the empty string being considered as an absence of placeholder, this should be tested this way I think :
To reproduce the bug, try a ChoiceType field that is required, with an empty placeholder (
['placeholder => '']
in the options array of the form), and see that it takes the first value when changing another field of the form.Not a big deal, but I had to investigate why the behaviour was different in the previous version, so I might not be the only one.
The text was updated successfully, but these errors were encountered: