Re: Quickform rules
| From: | Brett Bieber | Date: | Fri, 08 Aug 2008 13:20:45 +0000 |
| Subject: | Re: Quickform rules | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-29152@lists.php.net to get a copy of this message | ||
On Mon, Aug 4, 2008 at 8:16 AM, Florian van Eerd <florian@vaneerd.de> wrote:
> Hi folks!
>
> I don't know why, but this doesn't work:
>
> $form->addElement("text", "surname", "$_0103:",
> array('size' => 50,
> 'maxlength' => 255, 'value' => $surname));
> $form->applyFilter('surname', 'trim');
> $form->addRule('surname', 'Please enter 'surname',
> 'required', null,
> 'client');
> $form->addRule('surname', 'Last name must not be longer than 20
> characters', 'maxlength', 20);
>
> The Filter for 'required' works perfectly fine. But I can enter as many
> characters as I want to, without raising an error...
> What do I do wrong?
>
I think you're missing 'client' as the last parameter.
$form->addRule('surname', 'Last name must not be longer than 20
characters', 'maxlength', 20, 'client');
--
Brett Bieber
http://saltybeagle.com/