RE: [PEAR] QF controller Previous page causing validationexecution
| From: | Mike Carter | Date: | Mon, 22 Sep 2003 15:30:29 +0000 |
| Subject: | RE: [PEAR] QF controller Previous page causing validationexecution | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7977@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Bertrand Mansion [mailto:bmansion@mamasam.com]
>
> <borz_off@cs.msu.su> wrote :
>
> > Well, JS validation in QuickForm is bound to form's
> onSubmit handler.
> > You probably need to do something in "previous" button's onClick
> > handler to prevent validation from running. BTW, please post the
> > solution you find here, I think many people may be interested in it.
>
> With the new Controller class and modal/non-modal validation,
> that's probably something we will have to deal with.
>
> At the moment, I am not sure whether
> onclick="this.form.submit()" will call the onSubmit event
> handler of the form. Maybe you can give it a try.
I currently have three pages in my form wizard.
Adding the above onClick to my previous button (on page 3) still makes
the javascript validation for the form appear. After clicking okay
though, the form goes back to the first page. Not sure if it is just
skipping a page or just going back to the first. I guess I'll only find
out when I add further pages to the wizard. :-/ Which will be soon
anyway.
Hmm, as I've said on this list before - my javascript is less than
hot... But I just discovered the following which appears to work
(although skips back to page1 from page3).
$buttons[] =& HTML_QuickForm::createElement('submit',
$this->getButtonName('previous'), '< prev', 'onClick' =>
"this.form.submit();return false;"));
The 'return false' cancels the default action according to the book I
have here :o)
Any ideas on the skipping a page problem now though? :-/
Regards,
Mike C.
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________