|
Posted by Jonathan N. Little on 10/14/06 11:31
Ed Jay wrote:
> Guillaume <nospam@nospam.com> wrote:
>
>
>>Ed Jay:
>>
>>>1. How can I either test the error while still on Page 1?
>>
>>Javascript
>>
>>
>>>2. How do I test for the Page 1 error on Page 2 and automatically return
>>> the op to Page 1 for corrections?
>>
>>Redirect (set the appropriate headers + eventualy javascript code)
>
>
> Understood; however, I either have to regenerate Page 1 with a new error
> message, or stop at Page 2 with the error message and then resubmit to
> Page 1 with all the 'good' variables intact and figure out how to
> check/uncheck checkbox buttons on Page 1.
>
> I may have figured an easy solution explained in my very recent post in
> response to mbstevens, i.e., print the error message on Page 2 and use
> javascript to return the guy to Page 1 as held in the cache. The only
> issue I see with this method is unchecking the checkboxes or radio buttons
> that were incorrectly checked.
>
Normally I would approach a multi-page form with a single Perl script,
which posts back to itself on each step. Process the query in a matrix
before generation of the page so if the 1st page's fields pass muster it
will then generate the 2nd page's form with 1st page's fields in hidden
fields, if not then regenerate 1st page with bad fields marked. And then
so on for each page. Than I add a JavaScript validation for each page so
IF the visitor has JavaScript enabled, the script can interrupt the
submission and alert the error fields without a server call. A nice
option but not required because it will be validated again by the CGI.
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
[Back to original message]
|