Quickform Validation rules for grouped elements
| From: | Mike Carter | Date: | Wed, 21 May 2003 16:56:03 +0000 |
| Subject: | Quickform Validation rules for grouped elements | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5517@lists.php.net to get a copy of this message | ||
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
And then the label for the group 'Associated website'. Becomes red, but no
error messages are shown. I think the second problem could be another bug
in the dynamic smarty template. What about the regular expression bug
though?
Thanks for all the responses so far. I look forward to one day reading a
manual :-)
Regards,
--
Mike Carter [web developer]
tel: 01925 758229 // fax: 01925 758023 // web: www.koa.uk.com
This message is confidential.
Unless you are the named addressee or their delegated representative you may
not use, disclose, or copy the contents of the e-mail. If you are not the
named addressee please notify the sender immediately and delete the material
from your computer. Any views or opinions contained in this e-mail are
solely those of the author unless expressly stated otherwise
---
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
________________________________________________________________________