Sorry, I missed the part that said your form was in the
session. 

And I also forgot that I do subclass my DynaValidatorActionForm and 
add the following code to the reset().

 public void reset(ActionMapping mapping, HttpServletRequest request) {

        this.initialize(mapping);       
 }

It works for me. Good luck with your solution.


robert


> -----Original Message-----
> From: Jim Kennedy [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 30, 2004 5:02 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Problem with html:multibox not clearing
> 
> 
> Just an FYI, this did not work.  I don't believe it's a reset() issue.  From
> other threads, it's the way an http request is sent when no checkboxes are
> selected. Since nothing gets sent, nothing gets changed.  I will write some
> JavaScript to manually check to see if anything has been checked.  If no
> boxes are checked, I will artificially create a form element that has the
> same name as the checkboxes.
> 
> That's my solution.
> 
> L8r and thanks
> 
> 
> -----Original Message-----
> From: Robert Taylor [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, March 30, 2004 4:00 PM
> To: Struts Users Mailing List
> Subject: RE: Problem with html:multibox not clearing
> 
> Jim, you can try this in your dynavalidatorform declaration:
> 
> <form-property name="amenity"                 
>                type="java.lang.String[]"  
>                initial="{}"/>
> 
> When you invoke an action, Struts will automatically reset your form.
> So when you hit submit, Struts will invoke form.reset() which will reset all
> your form properties to their initial values.
> 
> If you declare your initial value as an empty array (as above), then if
> nothing is checked, the array will be empty. If something is checked, it
> will be populated by the values in the request.
> 
> Give it a try. 
> 
> robert
> 
> 
> 
> > -----Original Message-----
> > From: Jim Kennedy [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, March 30, 2004 3:42 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: Problem with html:multibox not clearing
> > 
> > 
> > That's not what I had in mind.  Thanks for the suggestion though.  I 
> > found a thread that suggests that you must subclass dynavalidatorform 
> > and override the reset() method.  Not really sure how that will help.
> > 
> > My form is a multipage form and the dynavalidatorform is in the session.
> > 
> > I now know why it happens, but are there any other suggestions? 
> > 
> > 
> > 
> > -----Original Message-----
> > From: Wiebe de Jong [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, March 30, 2004 3:31 PM
> > To: 'Struts Users Mailing List'; [EMAIL PROTECTED]
> > Subject: RE: Problem with html:multibox not clearing
> > 
> > This is an HTTP problem. If the user clears all the checkboxes, the 
> > browser doesn't send anything back to the server. In this case, it 
> > seems that all the checkboxes still have their default value.
> > 
> > To fix this, I included a hidden checkbox on the form that is always 
> > checked. The user can't see or modify it, so it will always remain
> checked.
> > This ensures that the browser will always send back the checkbox list, 
> > even if all the checkboxes that the user can see are cleared.
> > 
> > Wiebe
> > http://frontierj.blogspot.com
> > 
> > 
> > -----Original Message-----
> > From: Jim Kennedy [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, March 30, 2004 12:06 PM
> > To: 'Struts Users Mailing List'
> > Subject: Problem with html:multibox not clearing
> > 
> >  I am using an html:multibox that is pretty much working fine except 
> > when I uncheck all choices. I am also using the logic:iterate tag to 
> > generate many checkboxes.  If I have a single box checked I can't seem 
> > to uncheck it if it's the last one.  If I have several checked, I can 
> > uncheck them one at a time and that works.  At least until I get down 
> > to just one checked.  Very odd.  The problem seems to be that I can't 
> > get Struts to realize that there are no checkboxes checked after I submit
> the form.
> > 
> > I am using struts 1.1, with DynaValidatorForm's.  Here's some of my code:
> > 
> > ...
> > <form-property name="amenity"               type="java.lang.String[]" />
> > 
> > 
> > ...
> >     <td colspan="4">
> >     <logic-el:iterate id="item" name="amenities" indexId="i">
> >             <html-el:multibox  property="amenity">
> >                     <bean:write name="item" property="code"/>
> >             </html-el:multibox>
> >                     <bean:write name="item"
> > property="description"/>&nbsp;&nbsp;
> >     </logic-el:iterate>
> >     </td>
> > 
> > Don't think the above is the issue.  It's something deeper I think.
> > 
> > Any help is appreciated.
> > 
> > Jim Kennedy
> > IT Consultant
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > 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]
> > 
> > 
> > ---------------------------------------------------------------------
> > 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]
> 
> 
> ---------------------------------------------------------------------
> 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