You can either use a plain old <input type="checkbox"/> (since you're using the simple theme anyway and the struts internal support won't work without the hidden field). Or you can edit the FreeMarker template in the simple theme. But both of these will kill Struts' ability to inject the proper value into your action for you. (*Chris*)
On Fri, Sep 4, 2009 at 3:59 PM, Tommy Pham <[email protected]> wrote: > ----- Original Message ---- > > From: pallav_bora <[email protected]> > > To: [email protected] > > 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: [email protected] > > For additional commands, e-mail: [email protected] > > 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: [email protected] > For additional commands, e-mail: [email protected] > >

