Re[2]: [PEAR] [QUICKFORM] Question about QuickForm
| From: | Stanislav Okhvat | Date: | Fri, 29 Aug 2003 04:18:51 +0000 |
| Subject: | Re[2]: [PEAR] [QUICKFORM] Question about QuickForm | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7457@lists.php.net to get a copy of this message | ||
Hi, Alexey,
>> 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.
AB> Well, I think it's possible, you'll just have to hack getValidationScript() a
AB> bit. Feel free to propose a patch. ;]
Okay, I'm quite busy with another project at the moment, but if this
doesn't get improved by the time I'll be free, I'll do it.
>> 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.
AB> Frankly, I do not see much use for this: instead of inventing Yet Another
AB> language to define the rules, why not just code a custom function in existing
AB> one and add it via addFormRule()?. Oh, one more reason to make it work with
AB> client-side validation as well...
AB> But I'll be interested to look at the "fixed" OOHForms anyway.
I agree with you on this one. At the time when I did the patch, I was
saddled with quite a few forms that had conditional logic, and making
a custom function to validate every element of the form just
because 2 or 3 elements needed conditional validation logic was too bothersome.
In any case, conditional logic only accounts for about 20% of all
custom validation needs, so you're right. By the way, I haven't found
any advanced custom validation examples in the docs, are there any?
I will try to send you updated OOHForms (I'll make inline comments on the added
sections) next week.
Best regards,
Stanislav