>From what I could gather, the problem is that this is a dynamic form, where the user can add new fields on the fly. When the form is submitted, the script doesn't know exactly how many checkboxes exist (because the user could have created 2, 3, 10, or 50 of them). That's why Mark can't use $request->hasParameter - it can both mean that the field wasn't checked OR that it never existed in the first place. It makes a difference :)
I didn't face that problem yet, but it seems that Klemens got a nice solution there - a custom widget that renders both a checkbox and a hidden field on the form, hence emulating the workaround mentioned on the original post. Cheers :) On Mar 27, 8:33 am, Mark Smith <[email protected]> wrote: > Apologies for the double post. I accidentially hit return before I > had finished: > > I am reading a dynamic form with a bunch of check boxes on it. It > would make my task so much easier if the unchecked fields got posted > with false or null values. > > The common workaround for this is a hidden input tag with the same > name:http://iamcam.wordpress.com/2008/01/15/unchecked-checkbox-values/ > > But in symfony you can't have 2 form widgets with the same name on the > schema... So is there a way to ensure that unchecked check boxes > still submit a value with symfony? > > Thanks for any help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
