QuickForm addGroupRule Question
| From: | Pete Soderling | Date: | Mon, 29 Aug 2005 01:26:29 +0000 |
| Subject: | QuickForm addGroupRule Question | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-20610@lists.php.net to get a copy of this message | ||
Hello,
I am trying to get group validation to work but am having trouble (I assume)
with the addGroupRule syntax. Here is some sample code:
$form_jobComp[] = &HTML_QuickForm::createElement('text', 'jobComp', NULL,
array('size' => 25, 'maxlength' => 10));
$form_jobComp[] = &HTML_QuickForm::createElement('advcheckbox', 'hideComp',
NULL, 'Hide Company', null, array('0', '1'));
$form->addGroup($form_jobComp, 'jobCompGroup', 'Company Name');
$form->addGroupRule('jobCompGroup', array('jobComp' => array('Please
enter a
company name', 'required', NULL, 'client')));
As you can see, the group consists of two elements: a text input field and a
checkbox. In my group rule, I really only want to validate that the text
field has data; the checkbox, of course, is optional.
However, the addGroupRule command doesn't appear to be processing correctly..
There is no error generated, yet the javascript popup does not show the
required notice for the 'jobComp' element.
Is there something I'm missing?
thanks,
--pete