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 PreviousNext Page3: even more advanced stuff PreviousFinish 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]
Re: Checkbox in a multiple-page form.
Same problem here as well. But in my case the checkbox values are coming from the database. So I can't set all checkbox properties to false in the reset() method. Any solution in mind? Affan - Original Message - From: ROSSEL Olivier [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 3:45 PM 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 PreviousNext Page3: even more advanced stuff PreviousFinish 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] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Checkbox in a multiple-page form.
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 PreviousNext Page3: even more advanced stuff PreviousFinish 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]
RE: Checkbox in a multiple-page form.
Same problem here as well. But in my case the checkbox values are coming from the database. So I can't set all checkbox properties to false in the reset() method. Any solution in mind? It is quite tricky. In the reset, you must check what's the page where you clicked the submit button. If you clicked the Next button of page 1, then you should reset the checkboxes of page 1. If you come from page 2, then you should do nothing. It works for me (I use a property in the submit buttons , for example moveFromPage1 in the Next button of page 1, moveFromPage2 in the Previous button of page 2). Then I check in my reset method: if (request.getParameter(moveFromPage1) != null) { setCheckboxes(false); } So the behaviour is ok: i click next from page 1: i am redirected to page 2. the reset is done: the checkboxes are reset to false (because i really moveFromPage1) the checkboxes that must be checked, because of the request values, are set to true. or: i click previous from page 2: i am redirected to page 1. the reset is done: the checkboxes are untouched (because i don't moveFromPage1) there are no checkboxes that must be checked (because there are no checkboxes values in the current request : it comes from page 2 which has none). Conclusion: in case 1, we reset() what the FAQ wants to reset(). in case 2, we reset() nothing. Clear? 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]
RE: Checkbox in a multiple-page form.
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... Really neat solution!!! Thanks a lot. May be Mr Husted should add that one in his tips. 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]