quickform : setChecked doesn't work
| From: | pear at elfloridita dot net | Date: | Tue, 26 Dec 2006 18:41:49 +0000 |
| Subject: | quickform : setChecked doesn't work | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-26202@lists.php.net to get a copy of this message | ||
Hi
I have a quickform form with two radio input. I want the first one to be checked when the page is loaded.
I tried :
$radios[] = &HTML_QuickForm::createElement('radio', null, null, 'label1', 'val1', array('class' => 'radio');
$radios[] = &HTML_QuickForm::createElement('radio', null, null, 'label2', 'val2', array('class' => 'radio');
$radios[0]->setChecked(true);
$form->addGroup($radios, 'grp', 'Label');
but that doesn't work, nothing's checked.
I also tried :
$radios[] = &HTML_QuickForm::createElement('radio', null, null, 'label1', 'val1', array('class' => 'radio', 'checked' => 'checked');
$radios[] = &HTML_QuickForm::createElement('radio', null, null, 'label2', 'val2', array('class' => 'radio');
$radios[0]->setChecked(true);
$form->addGroup($radios, 'grp', 'Label');
but the checked parameter is ignored (doesn't appear in HTML source)
Can someone help me ?
Julien