[QuickForm] addRule
| From: | talist at vif dot com | Date: | Wed, 29 May 2002 13:37:46 +0000 |
| Subject: | [QuickForm] addRule | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-1507@lists.php.net to get a copy of this message | ||
Bonjour Bertrand,
Could you please give an example for a validation rule on an ElementGroup.
All the examples provided perform validation on addElement fields
> Can anybody help on setting and "addRule" onto an "addElementGroup"
> What's wrong with the following code ?
>
> // Creates a group of text inputs
> $areaCode = &HTML_QuickForm::createElement('text', '');
> $areaCode->setSize(3);
> $areaCode->setMaxLength(3);
> $phoneNo1 = &HTML_QuickForm::createElement('text', '');
> $phoneNo1->setSize(3);
> $phoneNo1->setMaxLength(3);
> $phoneNo2 = &HTML_QuickForm::createElement('text', '');
> $phoneNo2->setSize(4);
> $phoneNo2->setMaxLength(4);
> $form->addElementGroup(array($areaCode, $phoneNo1, $phoneNo2),
> 'Telephone:',
> 'Phone', '-');
> $form->addRule('Phone', 'Phone is incomplete', 'required');
>