Re: [QUICKFORM] Question about QuickForm
| From: | Alexey Borzov | Date: | Thu, 28 Aug 2003 20:22:46 +0000 |
| Subject: | Re: [QUICKFORM] Question about QuickForm | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7451@lists.php.net to get a copy of this message | ||
Hi!
Stanislav Okhvat wrote:
I don't know whether you are the correct person to ask, but is it possible to enhance the javascript validation to set focus to the first unvalidated form element? It was kind of handy to have it as part of OOHForms.Well, I think it's possible, you'll just have to hack getValidationScript() a bit. Feel free to propose a patch. ;]
A while ago, I also suggested another handy enhancement to Bertrand, which is to do conditional validation of the form, i.e. a rule like '([email] && ([tel] || [fax]))' passes only if the email field and either tel or fax fields pass their own tests. This should be pretty easy to implement, since Javascript and PHP both have eval() methods and [] placeholders can be replaced with 'true' or 'false' depending on whether they passed their tests. I have a fixup of OOHForms that allows to do this, if you are interested.Frankly, I do not see much use for this: instead of inventing Yet Another language to define the rules, why not just code a custom function in existing one and add it via addFormRule()?. Oh, one more reason to make it work with client-side validation as well... But I'll be interested to look at the "fixed" OOHForms anyway.