am using <html:multibox> with LabelValueBean. the following is the code
<logic:iterate id="IDRequirement" name="InitialPageDetailViewBean" property="IDRequirements"> <html:multibox property="IDRequirementValues"> <bean:write name="IDRequirement" property="value"/> </html:multibox> <bean:write name="IDRequirement" property="label"/> </logic:iterate> The above code is rendering me all checkboxes with appropriate values. What i am trying to achieve is to make some of this checkboxes Checked based on a list. I am wondering if there is a straight forward way of doing it by passing my list as part of value in Multibox property.
Can any one suggest, how i can do this. I will really appreciate any help as i am nearing a deadline.....
I am now facing to a case that, when the value of the checkboxes is empty string, all boxes are checked.
But somehow the checkboxes really should not have any values, so, any method that I can have the empty value checkbox, but the checkboxes are NOT checked by default?
If you are using DynamicActionForms, and you are using <html:multibox> where having no boxes checked is a valid state, then you must exten org.apache.struts.action.DynamicActionForm and override reset(), setting your String to a new String of size 0.
Joined: Nov 07, 2003
How about if I am currently using ValidatorForm?
I have put all the *attributes* inside the Form, and for the checkboxes, I used Hashtable to keep track with it.
I have tried that, if I put a *space* in the *value*, even the real value is empty string, the checkboxes behave naturally. My workmates told me that this is the *default* behaviour of Struts.
Joined: Oct 08, 2001
Thanks All. Appreciate your help.
Jeanne, you helped me get my mental block released.....