struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Chisholm" <David_Chish...@i2.com>
Subject RE: Multi Page Form
Date Fri, 07 Jul 2000 00:56:56 GMT


> -----Original Message-----
> From: David Chisholm [mailto:David_Chisholm@i2.com]
> Sent: Thursday, July 06, 2000 12:43 PM
> To: struts-user@jakarta.apache.org
> Subject: RE: Multi Page Form
>
>
>
>
> > -----Original Message-----
> > From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
> > Sent: Thursday, July 06, 2000 11:34 AM
> > To: struts-user@jakarta.apache.org
> > Subject: Re: Multi Page Form
> >
> >
> > The following strategies seem like they might work for multi-page
> > ("wizard"
> > like) forms:
> >
> > * Do not validate each individual form; validate only at the end.
> >   (Not very good user interface technique, however).
> >
> > * Keep all the input in a single ValidatingActionForm, and
> >   include a hidden field on each page so that the form's
> >   validate() method knows which fields should be checked.
> >   This requires the form bean to know what fields are on
> >   what pages.  (The name of the hidden field would be the
> >   same on all pages, and would be a property of the form
> >   bean so that it gets set on every request.)
> >
>
> How about assigning the hidden field the names of all of the
> fields that are to be validated for the current form; creating an
> isValidXXX() method for each property of the bean (where XXX is
> the property name); and then using reflection to validate each
> property specified in the hidden field?  The ValidatingActionForm
> bean would not need to know the names of all of the fields on
> each page with this approach, but the disadvantage of course is
> the overhead of the additional introspection.
> David
>


Another improvement to this would be to use javascript in the JSP page to
dynamicaly gather all of the names of the fields in the form and assign them
to the hidden field.  Then the list of form fields to validate will
automatically update itself whenever the form fields change.  Finally, you
can wrap all of this up in a convenient JSP tag and hide it from the page
designer.
David






>
>
>
> > * Use separate form beans for each page (perhaps saved
> >   in the session), each of which validates its own input,
> >   and combine the results on the final submit.
> >
> > My personal preference would be for the second approach.
> >
> > Craig McClanahan
> >
> >
> >
> > Quaini Michele wrote:
> >
> > > (Hello to everyone on the list)
> > >
> > > Are you speaking about a wizard-like approach?
> > >
> > > This is exactly what we have to do for the next phase of
> > > our project. I also think the validation should be done
> > > after the user press the 'Next' button, an he user is not
> > > allowed to process further.
> > >
> > > Is there someone that has already made some like this with struts?
> > > I need help too in this matter.
> > >
> > > Michele
> > >
> > > -----Original Message-----
> > > From: Robert Edgar [mailto:robedgar@hkstar.com]
> > > Sent: mercoledì 5 luglio 2000 18.54
> > > To: struts-user@jakarta.apache.org
> > > Subject: Multi Page Form
> > >
> > > Can some give me an idea on how multipage forms are supposed to work.
> > >
> > > i.e. in the stuts registration example its a single page form
> > that gets auto
> > > validated, but how do you handle this in multi page forms when
> > you wont yet
> > > have completed parts of the form that maybe required but are on
> > a differnet
> > > page. I cant see how to handle this other than just manually
> > validate each
> > > page of the form by itself.
> > >
> > > Rob
> >


Mime
View raw message