Erez Efrati wrote the following on 9/12/2004 7:03 AM:

If I put it in the form bean constructor wouldn't it cause the field
value to be always "true" no matter if the user unchecks it and submit
the form.  As far as I can recall a checkbox field should be reset to
false before the form population.

I believe you would be correct in that if you do set a boolean checkbox property to true in your formBean (either in constructor or by declaration), you will end up with it remaining true if the user 'unchecks' the box on the form. This is because http does not send over the checkbox property if is not checked.


This is why I use a setUp method in my Action (like Craig mentioned) and usually I also make sure my boolean properties are reset to false in the reset method of my ActionForm. In the setUp method you could set up your initial ActionForm boolean property to be whatever you wanted (if it's false by default you wouldn't need to do this, but you would still want to make sure you used the reset method to set your boolean back to false if you plan on using Struts form validation).


-- Rick

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



Reply via email to