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