HTML_Quickform and default values
| From: | Paolo Sala | Date: | Thu, 23 Feb 2006 12:44:06 +0000 |
| Subject: | HTML_Quickform and default values | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-23095@lists.php.net to get a copy of this message | ||
Hi all, I have a little problem I can't understand with HTML_QuickForm class: how can I set a default value to an element of a named group?
If it is no so clear my question I try to explain you using an example. Consider the following code:
$arrDefaults=array([...], 'daData'=>date('d.m.Y'), [...]); $form = new HTML_QuickForm('myForm'); $daData[]=&HTML_QuickForm::createElement('text', 'daData', null, $attrData); $form->addGroup($daData, null, 'My date label: '); $form->setDefaults($arrDefaults); $form->display();All works well, the element daData have his default value; but
$arrDefaults=array([...], 'daData'=>date('d.m.Y'), [...]); $form = new HTML_QuickForm('myForm'); $daData[]=&HTML_QuickForm::createElement('text', 'daData', null, $attrData); $form->addGroup($daData, '*myGroup*', 'My date label: '); $form->setDefaults($arrDefaults); $form->display();Now the element daData doesn't have his default value. There is a way to put a default value on a element in a named group? Thank you very much. Piviul