Here's hoping somebody's still answering questions this close to Christmas
:)

I have a form that takes place over 3 pages, with prev and next buttons for
the user to navigate around with.  The buttons call their own "action" in my
dispatchaction, which increments the page # and sends to the appropriate
page.  Now that I'm at the end and have added in the validation for this
form, I realize that I may have made a wrong turn... since I can only supply
one "input" in my actionmapping and it really needs to be one of 3.  So,
while it does a lovely job of validating, its always returning me to the
wrong form :(

What I'd really like to do is just hard-code the input from the code in my
action... Is that possible?  Or do I need to go back to the drawing board?

Thanks for the help!
Janice

Here's the relevant bits (hopefully):

--------- start snip from struts-config---------------------
    <action path="/submission" 
            input=".submissionForm1" 
            parameter="action"
            type="web.actions.SubmissionActions"
            name="submissionForm" 
            validate="false">
      <set-property property="secure" value="false"/>
      <forward name="form1" path=".submissionForm1"/>
      <forward name="form2" path=".submissionForm2"/>
      <forward name="form3" path=".submissionForm3"/>      
      <forward name="gotoconfirm" path="/submissionConfirm.do" />
    </action>
--------- end snip from struts-config---------------------

--------- start snip from SubmissionActions---------------------
  // this is just a for example of what I'm doing in SubmissionActions to
move prev and next

  public ActionForward nextForm(ActionMapping mapping,
                                   ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response) {

    ActionErrors errors = form.validate(mapping, request);

    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      return mapping.getInputForward();
    }                                   

    DynaValidatorForm dvf = (DynaValidatorForm)form;
    int pageNumber = ((Integer)dvf.get("page")).intValue();
    pageNumber = pageNumber + 1;
    String target = "form" + String.valueOf(pageNumber);
    dvf.set("page", new Integer(pageNumber));
    return (mapping.findForward(target));
  }
--------- end snip from SubmissionActions---------------------


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

Reply via email to