Re: quickform, validation of date element
| From: | Julien Tschäppät | Date: | Mon, 01 Aug 2005 10:42:53 +0000 |
| Subject: | Re: quickform, validation of date element | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20210@lists.php.net to get a copy of this message | ||
I tried to do something with the example of the doc. I managed to get
a javascript box when a date is not given. But even if it's given the
box is displayed.
My test script :
$form = new HTML_QuickForm('test', 'post');
$test[] = &HTML_QuickForm::createElement('date', 'testDate', 'Date:
',
array('addEmptyOption' => true));
$form->addGroup($test, 'testGroup', 'Date :');
$form->addGroupRule('testGroup', 'Date required', 'required', null,
null, 'client');
$form->addElement('submit', 'submit', 'Test');
$form->display();
if($form->validate()) {
echo 'ok';
echo '<pre>';
print_r($_POST);
echo '<pre>';
}
2005/8/1, Alexey Borzov <borz_off@cs.msu.su>:
> Hi,
>
> Julien Tschäppät wrote:
> > I have problem to add a rule for a date element
> > ($form->addElement('date', 'testDate', 'Date: ',
> > $options) ). I tried
> > with $form->addRule('testDate', 'date required',
> > 'required') but that
> > don't work. I saw somewhere that I have to use a GroupRule. I don't
> > understand how I have to do that. Can someone help me ?
>
>
> http://pear.php.net/manual/en/package.html.html-quickform.html-quickform.addgrouprule.php
>