Re: QuickForm setDefaults problem ?
| From: | Bertrand Mansion | Date: | Sun, 01 Feb 2004 14:40:59 +0000 |
| Subject: | Re: QuickForm setDefaults problem ? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10472@lists.php.net to get a copy of this message | ||
<levy@vogn.is> wrote :
> Hi all.
>
> require_once "HTML/QuickForm.php";
>
> $form = new HTML_QuickForm('formAddUser', 'post');
> $form->setDefaults(array( 'name' => '1' )); //Hvave tried to put
> 'Paul' also
>
> $form->addElement('select', 'name',
>
> 'Names:',array('1'=>'Paul','2'=>'Jack'));
>
>
> $form->addElement('reset', 'btnClear', 'Clear');
> $form->addElement('submit', 'btnSubmit', 'Submit');
>
>
>
> if ($form->validate()) {
> // Form is validated, then processes the data
> $form->freeze();
> echo "\n<HR>\n";
> }
>
> $form->display();
> ?>
> -------------------------------------------------------
> setSelected(); doesn't work either, have tried that.
> I don't understand what I'm doing wrong and I think I have tried every
> possible workarounds (execpt for the right one ofcourse :P) ca someone
> please reply, I really am desperate :/
If the following:
$form->setDefaults(array('name' => 'Paul'));
$form->addElement('select', 'name',
'Names:', array('Paul', 'Jack'));
$form->display();
does not work, then it might be your version of HTML_Common that is not up
to date.
Bertrand Mansion
Mamasam