If you track the wizard steps (e.g. with a hidden field), then you can
validate different sets of fields, depending on the current step. At the
final step, you can do a more complete validation.
--
Martin Cooper
Tumbleweed Communications
At 09:41 AM 11/2/00 -0300, Ansaldo, Gaston wrote:
Peter:
Thanks for your input but I can't wait until the user has reached
the form's last page because depending on her selections i have to send her
to a different JSP. Any other idea about this?
Thanks again,
Gastón.
-Original Message-
From: Halverson, Peter [mailto:[EMAIL PROTECTED]]
Sent: 01 November, 2000 5:51 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Multi page form desing
-Original Message-
From: Ansaldo, Gaston [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 01, 2000 3:29 PM
To: '[EMAIL PROTECTED]'
Subject: Multi page form desing
Hi all!!!
I'm trying to implement a *wizard style form* using 4 or 5
jsp's. I read in
the user doc's that in Struts one should try to design the
pages using the
same Form and Action class for all the pages inside
the *conceptual
form*
I'm wondering how I'm suppose to design the Form and
Action classes
in order to validate the form data just one time and not as
many times as
jsp's invoke the same XXXForm class..
Can anybody share some ideas about how to implement this kind of
functionality?
You'd need to track whether the form is all the way done or
in progress,
depending on which screen of the wizard the user has
completed. Either
explicitly, as a form property that gets set by the Action,
or implicitly,
perhaps using a custom ActionMapping property (the latter
makes it easier to
introduce new pages, IMO, since you can define it as part of your
struts-config.xml). As long as there still screens to do, the form's
validate() method would always return true. Only when the
user has finished
all the screens do you actually check the form content as
appropriate.
Ditto for the action, assuming you're using a single Action
for the entire
sequence.
The only problem with deferring validation until the wizard
is complete is
that it's harder to return the user to the particular page
associated with
the bad input.
pete