Still confused. So in my reset method, I run through all my beans and if
the property is false, I set it false again? Does not compute? I guess I'm
not sure how to get the "corresponding" boolean property?
What I have is a list of checkboxes that may be initialized to true or false
depending on the beans state. When a user "unchecks" one of these, how do I
know which property to set to false in the reset method?
--m
----- Original Message -----
From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 15, 2001 5:35 PM
Subject: Re: <html:checkbox>
>
>
> On Fri, 15 Jun 2001, Mike Thompson wrote:
>
> > Can someone clarify the following:
> >
> > WARNING: In order to correctly recognize unchecked checkboxes, the
> > ActionForm bean associated with this form must include a statement
> > setting the corresponding boolean property to false in the reset()
> > method.
> >
> > Does this mean that if I use check boxes I have to stash the current
> > state of my properties somewhere. How do I know which property has
> > been "unchecked"?
> >
>
> The assumption is that you are using a boolean property to correspond to
> the checkbox field. Due to the wierd way that HTML submits work, you have
> to take special precautions on *all* your checkbox-based fields.
>
> With Struts, all you have to do is set the corresponding boolean property
> to false in your reset() method. If the checkbox was actually checked,
> the automatic property setting that is done by the controller servlet will
> cause it to be set back to true. If the checkbox was not checked, the
> boolean property will remain false. That way, when you get this property
> in your action, it will always reflect the state of the checkbox that the
> user sees.
>
> >
> > --m
> >
> >
> >
> > Michael R. Thompson
> > http://www.instanton.com
> > 512.439.3815
> >
>
> Craig
>