Re[2]: [PEAR] [QUICKFORM] Question about QuickForm
| From: | Stanislav Okhvat | Date: | Tue, 26 Aug 2003 08:13:34 +0000 |
| Subject: | Re[2]: [PEAR] [QUICKFORM] Question about QuickForm | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7416@lists.php.net to get a copy of this message | ||
Hi, Alexey, and thanks for your answers,
My fault, it seems that the form in the example, instead of being
reposted, was loaded from the cache so I got red warnings all over the
form.
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.
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.
Thanks,
Stanislav
AB> Hi!
AB> Stanislav Okhvat wrote:
>> I did a quick test of QuickForm (QuickForm_example.php in docs/ dir)
>> and have a question. If I pass a single variable to the page, say
>> 'yes=1', which is not part of the form, why is the form redisplayed
>> automatically with red messages indicating required fields, etc? I am
>> wondering how to go about coding simple add/modify forms where the
>> mode (i.e. add/modify) and record ids will be passed into the page via
>> the GET method.
AB> You can create POST method forms, the problem with QuickForm_example.php is that
AB> it is GET method.
>> In OOHForms, we had to manually validate the form on
>> the basis of the existence of certain hidden variables (which
>> indicated that the form was actually posted), but
>> in this example, the error messages are displayed regardless of
>> whether the validate method is called or not.
AB> The same approach may be used for QuickForm. There is NO automagic validation,
AB> you have to call validate() method manually.
Best regards,
Stanislav mailto:stanis@sibfair.nsk.su