----- Original Message ---- > From: pallav_bora <pallav_b...@rediffmail.com> > To: user@struts.apache.org > Sent: Friday, September 4, 2009 11:16:37 AM > Subject: Checkbox and hidden field > > > Hi I am using Struts 2.1.6 > > I am using simple theme. When I use a checkbox tag , a hidden field is > automatically iserted in the final HTML. Please let me know how to get rid > of this hidden field. I have given code sample below: > > Code in JSP: > > > fieldValue="true" /> > > Code in HTML: > > > id="formId_checkboxField1"/> > > name="__checkbox_checkboxField1" value="true" /> > > Thanks > > Pallav > > -- > View this message in context: > http://www.nabble.com/Checkbox-and-hidden-field-tp25299309p25299309.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org
I haven't had the chance to look at Struts' source code yet but I think it's there so the action class can tell the value of checkbox submission to set the value of the corresponding field. The value 'on' of the checkbox is submitted only if the checkbox is 'checked'. I could be wrong. (I noticed that hidden field too when I used the checkbox. If you noticed, the tags reference saids 'name' is optional. But if you omit it, you'll get null exception. ) Regards, Tommy --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org