Re: HTML_QuickForm With Arrays as Text Elements?
| From: | Bertrand Mansion | Date: | Wed, 05 Nov 2003 15:36:36 +0000 |
| Subject: | Re: HTML_QuickForm With Arrays as Text Elements? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8776@lists.php.net to get a copy of this message | ||
<jkaufman@wamnetgov.com> wrote :
> What is the correct way of doing this sort of thing:
>
> $form->addElement ('text', "reqdate[]", 'Req. Start',
> array('size'=>'10', 'id'=>'sd0'));
> $form->addElement ('text', "reqdate[]", 'Req. Start',
> array('size'=>'10', 'id'=>'sd1'));
>
> I need to validate the data using Javascript, and $reqdate[] will look
> like:
> reqdate[0] = '12/15/2003'
> reqdate[1] = '01/22/2004'
>
> I know how to do it w/o QuickForm. Can it be done with QuickForm?
Rename your elements to something that javascript can understand ie
reqdate[0], reqdate[1] for example instead of reqdate[].
Then use $form->addRule('reqdate[0]', 'Date not good', 'regex',
xxx,
'client');
Writing the regex that will replace xxx is left as an exercice for you.
Bertrand Mansion
Mamasam