DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12573>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12573

Handling of HTML-Checkboxes and (dynamic) FormBeans result in false values

[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From [EMAIL PROTECTED]  2003-02-14 17:18 -------
Struts already provides the machinery to deal with checkboxes correctly.  All
you have to do is follow the rules:

* The checkbox must be represented by a boolean property in the ActionForm
  bean.

* In the reset() method of your ActionForm bean, set the corresponding
  boolean property to false.

* In a setup Action, you can preconfigure the checkbox to appear as checked
  when the form is displayed, by setting the boolean property to true.

* When Struts receives the submit from your form, it calls the reset method
  of your ActionForm bean (which sets the boolean property to false), and
  then sets it to true again if your browser submitted the field -- in other
  words, if the checkbox was checked.

* The net effect is that, after the form is submitted, the boolean property
  always represents the checked state on the form -- IF AND ONLY IF you
  follow the rule above about the reset() method.

This solution has existed since the very very first 0.0.1 releases of Struts,
and it is documented in the User's Guide (and the tag library information about
the <html:checkbox> tag, and is illustrated in the struts-example web
application that is distributed in Struts.

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

Reply via email to