-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Form: choice with expanded=true does not retain boolean values #15573
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
It's always the same ... I've found the issue already reported: #14712 Sorry for the duplicate, but feel free to take the unit test :) |
I found a workaround for that: attaching a NoopDataTransformer on the choice field (a DataTransformer doing nothing and just returning the value as it). Note that in case your choice field is not required, you will still need a custom |
Thanks stof, this workaround worked for me! 👍 |
This behaviour seems to be related to what @DancZer observed in #5906 (comment). |
@stof Note that the workaround doesn't work with Symfony 2.8.5; probably after the #18180 PR. I had to remove the workaround |
@alexislefebvre Yes #18180 fixes it once and for all ;) |
@HeahDude Yes, but it also broke the workaround, so I wanted to inform other users just in case they missed this information. |
You're right, I wasn't questioning it :) Thanks! |
@alexislefebvre my workaround was for a case where the |
I have a form with the following code:
When submitting the form, none of the two radio buttons are selected, i.e. the values are lost.
I've written a unit test for it in imphil@71a59b7
Currently it fails with
The problem only happens with boolean values and expanded=true. It seems that a proper conversion to the view data is missing. Unfortunately I have no idea about the inner workings of Symfony -- maybe someone with a bit more experience can have a look?
(This seems to be similar to #14877, but maybe not exactly the same, so I didn't want to hijack that issue.)
The text was updated successfully, but these errors were encountered: