RE: [PEAR] Quickform rules & documentation
| From: | Mike Carter | Date: | Wed, 21 May 2003 16:47:44 +0000 |
| Subject: | RE: [PEAR] Quickform rules & documentation | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5516@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Bertrand Mansion [mailto:bmansion@mamasam.com]
>
> <mcarter@quantiv.com> wrote :
>
> > Did I see somewhere that you can specify regular expressions to
> > validate form field content? I can't find any examples of
> it in use
> > now!
> >
> > I wanted to check if a URL was valid using:
> >
> ^(http|https|ftp)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?
> > ([a-zA
> > -Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*$
>
> $form->addRule('urlfield', 'URL not good, baby', 'regex',
> '/^(http|https|ftp)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-
> Z0-9]*)?/?([a-
> zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*$/');
How do the extended parameters work in Quickform? Are they always checked
in pairs? I've noticed some code contains ,null, in the parameter list as
if it was a padding.
I'm thinking about some of the single parameter ones such as 'client' and
'required'. Should they be provided along with a null to make the pair?
Such as:
$form->addRule('news_editor', 'Editors name is a required field',
'required', null, 'client', null);
Or is $form->addRule('news_editor', 'Editors name is a required field',
'required', 'client'); fine?
Regards,
Mc.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.480 / Virus Database: 276 - Release Date: 5/12/2003
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________