Thanks James, now all the other stuff that I read about reset makes
sense.  I had been assuming that since I don't have a reset function
for my form that I didn't need it.

Now I'm having issues with my nested forms.  Does anyone have a
recommendation on how to deal with them?

This is what I've done:

<... snip from reset method ...>

    if (thePage == 2) {
      if (map.containsKey("dfcAPInd")) map.put("dfcAPInd", Boolean.FALSE);
 
      subformReset("projectTypes", map, actionMapping,
httpServletRequest);

<... end snip from reset method ...>

<... snip subformReset method ...>
  private void subformReset(String key, Map map,
    ActionMapping actionMapping, javax.servlet.http.HttpServletRequest
httpServletRequest) {
  
    if (map.containsKey(key)) {
      ArrayList list = (ArrayList)map.get(key);
      Iterator it = list.iterator();
      DynaValidatorSimpleXrefForm widgetFormBean;

      while (it.hasNext()) {   
        widgetFormBean = (DynaValidatorSimpleXrefForm)it.next();   
        widgetFormBean.reset(actionMapping, httpServletRequest);
      }
    }
  }
<... end snip subformReset method ...>

The reset method in the nested form only resets a couple of
checkboxes.  But now I get validation errors.  The validation on the
nested forms is as follows:

<... snip validation ...>
    <form name="SimpleXrefForm">
      <field property="isSelected" depends="requiredif">
        <arg0 key="xref.isSelected"/>
        <var>
          <var-name>field[0]</var-name>
          <var-value>comments</var-value>
        </var>
        <var>
          <var-name>fieldTest[0]</var-name>
          <var-value>NOTNULL</var-value>
        </var> 
        <var>
          <var-name>field[1]</var-name>
          <var-value>BMGS</var-value>
        </var>
        <var>
          <var-name>fieldTest[1]</var-name>
          <var-value>NOTNULL</var-value>
        </var> 
        <var>
          <var-name>field[2]</var-name>
          <var-value>ADDL</var-value>
        </var>
        <var>
          <var-name>fieldTest[2]</var-name>
          <var-value>NOTNULL</var-value>
        </var>  
        <var>
        <var-name>fieldJoin</var-name>
          <var-value>OR</var-value>
        </var>        
      </field>    
    </form>    
<... end snip validation ...>

It is like all the nested forms throw an error if they haven't been
filled out at all.  So if I have 10 projectTypes and I check off 3 of
them, I get 7 errors.

Any ideas?  Thanks in advance, J


--- In [EMAIL PROTECTED], "James Mitchell" <[EMAIL PROTECTED]> wrote:
> The problem is that the browser submits a value of "on", when you
check a 
> checkbox and submit the form.  However, if you uncheck the checkbox and 
> submit the form, the browser does _not_ submit "off" or "false" or
anything. 
> So, with your form sitting in session, how will it know that you
want it 
> "off"?
> 
> Here's how:  you need to implement reset() method on your form.  In
that 
> method you need to set the field that is backing the checkbox to
"false" or 
> "off".  When Struts processes the request, it will call reset, then 
> repopulate based on request....effectively giving the _appearance_
that the 
> browser sent "off".
> 
> 
> --
> James Mitchell
> Software Engineer / Open Source Evangelist
> EdgeTech, Inc.
> 678.910.8017
> AIM: jmitchtx
> 
> ----- Original Message ----- 
> From: "Janice" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, February 03, 2005 6:32 PM
> Subject: wizard form and checkboxes that won't turn off
> 
> 
> Could somebody please refer me to a solution to this?
> 
> I have a form bean (session-scoped) that is displayed over 3 pages.
 There
> are "back" and "next" buttons.  Once a checkbox is selected and the
user has
> moved to another page, it can't be cleared again.  I have read that
this is
> because the checkbox item is now in the session and simply unchecking it
> does not remove it from the session.  What I haven't found is a
solution or
> workaround.
> 
> I am using struts 1.1.
> 
> Thanks very much in advance,
> J
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]




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

Reply via email to