Re: Quickform Validation rules for grouped elements
| From: | Bertrand Mansion | Date: | Wed, 21 May 2003 17:22:19 +0000 |
| Subject: | Re: Quickform Validation rules for grouped elements | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5518@lists.php.net to get a copy of this message | ||
<mcarter@quantiv.com> wrote :
> Hello again,
>
> Just getting a little confused by the amount of nested arrays needed for
> addGroupRule() !
>
> I've defined a sub-group in my Quickform using...
> $name['news_linkurl'] = &HTML_QuickForm::createElement('text',
> 'news_linkurl', 'URL:');
> $name['news_linkurl']->setSize(20);
> $name['news_linkname'] = &HTML_QuickForm::createElement('text',
> 'news_linkname', 'Title:');
> $name['news_linkname']->setSize(30);
> $form->addGroup($name, 'news_link', 'Associated website');
>
> I then want to add two rules to each of the text elements. I've just
> tried...
>
> $form->addGroupRule('news_link', array(
> 'news_linkurl' => array(array('Related URL is not well formed',
> 'regex',
> "^(http|https|ftp)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-z
> A-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*$")),
> 'news_linkname' => array(array('URL Title must be at least 5
> characters', 'minlength', '5'))
> ));
>
> When I submit my form I get a PHP warning displayed at the top:-
> Warning: No ending delimiter '^' found in c:\php4\pear\HTML\QuickForm.php on
> line 1452
Must be something wrong with your regex.
Bertrand Mansion
Mamasam