Hi,

Actually you would have the same problem on pages 2, 3, etc. if there were
any checkboxes.

we had the same problem and solved it by writing separate reset functions
for each page.

In the general action forms reset method an additional property (e.g.
pageId) of the action 
form controlls the execution of the correct reset function.

The value for the property (pageId) is set by the browse buttons for your
pages.

In our case we set the property in the action class extened by
LookupDispatchAction, so if we 
pressed the button for Page2 the property pageId is set to page2 and only
the reset method of
page2 is executed.

Hope this helps...

Some code snippets:

/**************************************************************
 * From the action class extended from LookupDispatchAction
*/
    protected Map getKeyMethodMap() {
        Map map = new HashMap();
        
        System.err.println("Method: getKeyMethodMap");
        
        map.put("MyApp.Wizard.Page1.Label", "page1");
        map.put("MyApp.Wizard.Page2.Label", "page2");
        //... and many other button mappings....
        
        return map;
    }
    
    public ActionForward page1(ActionMapping mapping, 
                                         ActionForm form, 
                                         HttpServletRequest request, 
                                         HttpServletResponse response)
throws IOException, ServletException {
        System.err.println("Method: page1");
        // get the form
        MyActionForm f = (MyActionForm)form;
        f.setPageId("page1");
        return mapping.findForward("page1");
    }
    
    public ActionForward page2(ActionMapping mapping, 
                                         ActionForm form, 
                                         HttpServletRequest request, 
                                         HttpServletResponse response)
throws IOException, ServletException {
        System.err.println("Method: page2");
        // get the form
        MyActionForm f = (MyActionForm )form;
        f.setPageId("page2");
        return mapping.findForward("page2");
    }

/**************************************************************
 * From the action form extened from ActionForm
*/
    private void reset1(ActionMapping mapping, HttpServletRequest request) {
        System.err.println("MyWizardForm.reset1");
        
        // code to reset the checkboxes of page1...
    }
    
    private void reset2(ActionMapping mapping, HttpServletRequest request) {
        System.err.println("MyWizardForm.reset2");

        // code to reset the checkboxes...
    }
    
    public void reset(ActionMapping mapping, HttpServletRequest request) {
        System.err.println("MyWizardForm.reset (master)");
        // reset the checkboxes...

        if (this.pageId.equals("page1")) reset1(mapping, request);
        if (this.pageId.equals("page2")) reset2(mapping, request);
    }

-----Original Message-----
From: ROSSEL Olivier [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 07, 2003 11:46 AM
To: '[EMAIL PROTECTED]'
Subject: Checkbox in a multiple-page form.


I have a form on 3 pages.
So my form bean is in session scope.

The JSP are as follows:

Page1:
some text inputs+some checkboxes.
      Next>>

Page2:
more advanced stuff
  <<Previous    Next>>

Page3:
even more advanced stuff
  <<Previous    Finish

My problem is the classic problem of checkboxes.
I do check some of them on page1.
I go to page 2, then to page 3.

Then back, back.
And guess what? 
All my checkboxes on page 1 are empty.

Of course, they are empty cause I coded that
in the reset() method of my form bean:
all checkboxes <= false.
(it's in the FAQ).

Well, replacing the value of the checkbox with false
seems to have erased the value the user had chosen.

I (of course) missed something.

Any help?


---cut here---


This e-mail is intended only for the above addressee. It may contain
privileged information. If you are not the addressee you must not copy,
distribute, disclose or use any of the information in it. If you have
received it in error please delete it and immediately notify the sender.
Security Notice: all e-mail, sent to or from this address, may be accessed
by someone other than the recipient, for system management and security
reasons. This access is controlled under Regulation of Investigatory Powers
Act 2000, Lawful Business Practises.

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

Reply via email to