Thanks for the comments, Mark!

> Personally, I rarely use multi-page forms have felt in the past that
> hidden fields + sessions were enough tools to solve the issues that came
> adequetely.

At work I've got a bunch of multi-page wizards that I'm converting over
to CGI::Application.  So that's my motivation.

The wizards currently use hidden fields to maintain state.  The problem
with this approach is that each page has to validate not only its own
data, but also the hidden field data from all the pages that precede
it.

Among other things, this approach is really hard to test.

If there's an error in a hidden field associated with a previous page,
the wizard has to return to that page.  So what I did in the original
apps was make each page run all of the previous pages' validation
routines (in order).

This is all quite possible to do in cgiapp, and I was even considering
making a Wizard plugin to abstract some of the mechanics.

But it turns out that storing the validated data in FormState is a much
simpler solution.  You don't have to keep re-validating the data from
previous pages because it has already been validated once, and securely
stored in the form state.

Also, there's no need to add all the mechanics for magically reverting
to previous pages.  In fact, a wizard can be very simply implemented:
when one form page is finished, it forwards or redirects to the next
page. When the last page is finished, a 'final' runmode examines the
data collected in FormState and does whatever processing needs to be
done with that data.

At least, that's the theory.  I'll have a better idea of how it works in
practice after I convert the wizards to FormState.

> Or put another way: It looks a like a useful tool for a specific
> problem, but it's more engineering than I tend to use.

Well, no one has ever accused me of under-engineering anything!


Michael


---
Michael Graham <[EMAIL PROTECTED]>


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to