-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Collection / allow_delete / removes items unwillingly #14938
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 it is there... got same issue, and provided "fix" in this issue actually works. Looks like if only field in form is collection, and that collection is submitted as empty - symfony doesn't detect form submission at all. In documentation of collection field, where there is cookbook with example of collection of emails, that example would not allow deleting last email in collection. Or deleting 8000 all emails at once. |
this is still opened. I also have this problem 😞 |
@cybernet Do you have some time to try to provide a fix ? If the bug is touching you it could ease the débugging process and the fix; tell me if you need help :). |
@Simperfit should i open a new ticket ? - my problem is with CheckboxType & ChoiceType |
lovely :) |
Hey, thanks for your report! |
There is a workaround. Closing for now. |
thanks for sharing 👍 |
I think it might be a conceptual issue that I came across today. I created a minimal example to reproduce the issue:
https://github.com/dmaicher/symfony2-collection-problem
So basically its a simple form with a collection type:
With this subform:
As I set
allow_delete
to true one should be able to remove items client side. The problem is if I now uncheck theenabled
checkbox for some of the options then the browser will not submit any values at all for those collection items (disabled field will be ignored & checkbox is not checked). So server side it seems like the whole form widget has been removed client side although that's not really the case here.Anyone ever had this issue?
I guess the only solution for now is to add an additional unmapped field to the subform that will be submitted by the browser?
Like:
Should this maybe be done automatically?
The text was updated successfully, but these errors were encountered: