RE: [PEAR] Quickform rules & documentation
| From: | Mike Carter | Date: | Wed, 21 May 2003 16:28:37 +0000 |
| Subject: | RE: [PEAR] Quickform rules & documentation | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5512@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Bertrand Mansion [mailto:bmansion@mamasam.com]
>
> <mcarter@quantiv.com> wrote :
>
> > Hi,
> >
> > Is there any documentation in the works for Quickform. From the
> > examples it appears more powerful than I currently know.
>
> Documentation is on its way. The part about form validation
> is written but not published yet. I currently have no idea
> when it will be published.
Hmm, not even a chance to see a sneak peek of the validation docs, maybe in
CVS? :)
> > I'm trying to understand the rules - there looks like a number of
> > possible options are available.
> >
> > However - I have a textarea called 'news_summary' which
> I've added the
> > rule: $form->addRule('news_summary', 'Provide more detail for your
> > summary', 'minlength', '10');
>
> If it's empty, it's not checked. You'll have to add a
> 'required' rule if you want it to be checked aven if it's
> empty. Then, your minlength rule will be validated.
Aah, clever stuff. It all becomes clear now.
> > When I submit the form this rule doesn't get checked - I assumed by
> > javascript? Also how does the PHP/server side validation happen?
>
> Server side validation is on all the time, you can't change
> that. Client side validation is activated if you add 'client'
> as last parameter:
>
> $form->addRule('news_summary', 'Provide more detail for your
> summary', 'minlength', '10', 'client);
Okay, makes more sense now.
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 vaid using:
^(http|https|ftp)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA
-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*$
Regards,
Mike c.
---
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
________________________________________________________________________