On 30 July 2010 18:56, strimp099 <[email protected]> wrote: > Greetings all: > > When sending form variables as a hash using Form.serialize(true), the > value attribute of unchecked checkboxes is sent to the POST page. This > of course is contrary to how HTML treats checkbox form variables. > > for example, I have the following checkboxes: > > <input type="checkbox" name="destructor" value="true" id="destructor" > checked="checked" /> > <input type="checkbox" name="constructor" value="true" > id="constructor" checked="checked" /> > > I only want destructor and constructor to be passed as true if the > checkbox is checked. Form.serialize(true) sends the true value even > when it is not checked. > > Does anyone know how to ensure that if a checkbox is not checked, the > value attribute will not be sent when using Form.serialize()? > > -- > You received this message because you are subscribed to the Google Groups > "Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en. > >
You've set the checked attribute on both of the checkboxes. So both are "checked" and both will be sent. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en.
