I have a Reset method, and I am calling  mFolders[i].setChecked(false) for
each item in my array. Is that what you mean by setting the default value
?
If so, it hasn't fixed my problem.

Thanx

> Have to set default value in reset method.
>
> Regards,
>
>
> PQ
>
> "This Guy Thinks He Knows Everything"
> "This Guy Thinks He Knows What He Is Doing"
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: February 26, 2003 1:18 PM
> To: [EMAIL PROTECTED]
> Subject: checkbox and iterate problem
>
> Hi,
>  I'm having a problem with checkboxes and I was hoping someone could
> help.
>
>  The short version is:
>    when using <logic:iteratate> over an array of checkboxes, the setter
> method is not called after submit
>
>  Long version
>    I have class   CheckableString { String str; boolean checked = false;
> // etc.. };
>    I have a Form
>        HostForm extends ActionForm {
>          CheckableString[] mFolders = new CheckableString[100];
>       public CheckableString getFolder(int n) {
>               System.err.println("HostForm getFolder a " + mFolders[n]);
>               return mFolders[n];
>       }
>       public CheckableString[] getFolder() {
>               System.err.println("HostForm getFolder b " + this);
>               for (int i = 0; i != mFolders.length; i++) {
>                       System.err.println("HostForm getFolder b " +
> mFolders[i]);
>               }
>               return mFolders;
>       }
>       public void setFolder(int n, CheckableString folders) {
>               System.err.println("HostForm setFolder a " + folders + " " +
> this);
>               mFolders[n] = folders;
>       }
>       public void setFolder(CheckableString[] folders) {
>               System.err.println("HostForm setFolder b " + this);
>               mFolders = folders;
>       }
>       public void reset(ActionMapping a, HttpServletRequest b) {
>               System.err.println("HostForm reset " + this);
>               flag = false;
>                               for (int i = 0; i != mFolders.length; i++) {
>                                       System.err.println("HostForm reset "
> + mFolders[i]);
>                                       if (mFolders[i] != null)
>
> mFolders[i].setChecked(false);
>                               }
>       }
>       }
>
>       I have an Action class setup the form, populating values from a
> database,
> it then forwards to a jsp page
> <html:form>
> ......
> <logic:iterate id="quack" name="hostForm" property="folder"
> indexId="index">
> <logic:present name='quack'>
>   <tr>
>     <th align="left">
>        <html:checkbox indexed='true' value='true' property="checked"
> name='quack' />
>        <bean:write name="quack"/>   <bean:write name="index"/>
>     </th>
>   </tr>
> </logic:present>
> </logic:iterate>
> ....
>
>
> The form is populated correctly, items marked as true are selected. And
> looking at the logs the getter function is called
> The problem is when I submit, the setter function is NEVER called, and
> the Form is not populated.
> note: If I have a simple non-indexed checkbox, then that works as
> expected and the setter is called
>
> I am using struts 1.1RC1
>
> Anyone got any ideas ??, I'm stumped
>
> Thanks
>
> Neal
>
>
>
>
>
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: [EMAIL PROTECTED] For
> additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to