Re: quickform, validation of date element
| From: | Alexey Borzov | Date: | Mon, 01 Aug 2005 13:17:33 +0000 |
| Subject: | Re: quickform, validation of date element | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20216@lists.php.net to get a copy of this message | ||
Hi,
Julien Tschäppät wrote:
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');You got it all wrong. You don't need to put date element into group since date element is a group itself, therefore: $form->addElement('date', 'testDate', 'Date: ', array('addEmptyOption' => true)); $form->addGroupRule('testDate', 'Date required', 'required', null, null, 'client');