RE: [PEAR] Quickform rules & documentation
| From: | Mike Carter | Date: | Wed, 21 May 2003 17:24:48 +0000 |
| Subject: | RE: [PEAR] Quickform rules & documentation | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5520@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Bertrand Mansion [mailto:bmansion@mamasam.com]
>
> > 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);
>
> $form->addRule('news_editor', 'Editors name is a required
> field', 'required', null, 'client');
>
> The extra parameter is to be used only when you need to pass
> a format (ex: a regex, a length, anything like an array etc.)
> to your validation function.
>
> Regex, minlength, maxlength etc are predefined validation
> "functions". You can use your own too, look at the examples.
Ah, docs/QuickForm_example3.php - I overlooked those examples as I started
off trying to understand how QuickForm integrated with Smarty; so ended up
only seeing the docs/renderers/ examples 8-)
Where are all the built in possible validations listed? Would be nice to
know.
> > Or is $form->addRule('news_editor', 'Editors name is a
> required field',
> > 'required', 'client'); fine?
>
> PHP newbie ? :)
Not quiet. Was possible your addRule method used its parameters like a CLI
based app might - only reading the next variable as an extra parameter if it
needed, otherwise the next one would just be read as another command - as in
the 'required', 'client' scenario.
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
________________________________________________________________________