I've found solution.
You can avoid this problem if you will add hidden field with the same name
as the checkbox. Like this :


*<html:checkbox name="resource" property="isProcessed"/>
<html:hidden property="isProcessed" value="" />
*


On Nov 20, 2007 11:12 AM, John Doe <[EMAIL PROTECTED]> wrote:

> Solution still needed. Forgot to say, I'm using struts 1.2.7
>
>
> On Nov 19, 2007 11:08 AM, John Doe <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> > I have a form declared in my struts config :
> >
> > *        <form-bean name="resourceForm" type="
> > org.apache.struts.validator.DynaValidatorForm">
> >            <form-property name="name"                      type="
> > java.lang.String" />
> >            <form-property name="path"                      type="
> > java.lang.String" />
> >            <form-property name="isProcessed"               type="
> > java.lang.Boolean" />
> >        </form-bean>*
> >
> > and here is my JSP code :
> >
> > *<html:form action="resourceEdited" method="POST" >
> >  ....
> > <html:checkbox name="resource" property="isProcessed"/>
> > ...
> > </html:form>
> > *
> > and my code in action
> >
> > *log.info("IS processed : " + dynaForm.get(
> > Constants.FormFields.IS_PROCESSED));*
> >
> > I always have null value first time I submit the form if resource bean
> > had isProcessed as false and then I always get true, no matter what is the
> > state of my checkbox.
> >
> > Here is the part of struts documentation about html checkbox element :
> >
> > *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.
> >
> > But I have no reset method, my form is declared in xml file.
> > Does any one know how to control checkbox right in this case?
> >
> > --
> > Best regards,
> > Bashmaкov Anton
> >
>
>
>
> --
> Best regards,
> Bashmaкov Anton




-- 
Best regards,
Bashmaкov Anton

Reply via email to