Re: quickform : setChecked doesn't work
| From: | Alexey Borzov | Date: | Tue, 17 Feb 2009 20:07:58 +0000 |
| Subject: | Re: quickform : setChecked doesn't work | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-29700@lists.php.net to get a copy of this message | ||
Hi,
Charly Pache wrote:
pear-2 wrote:Can you please quote a bit more when replying to a two-year-old message [1]?.. Or better yet, do not reply to a two-year-old message, but send a new message stating your problem.That works, thank you
It didn't for me, using QuickForm_Controller and QuickForm_Page..but I found the ultimate fix: set the wanted value of the radio group directly in the form's $_submitValues array, here we go: " $form->_submitValues['grp_name'] = 'val1'; // or val2 if you want the other one being checkedFooling around with private variables is a bad idea unless you know what you are doing and you obviously don't.
$radios[] = &HTML_QuickForm::createElement('radio', null, null, 'label1', 'val1', array('class' => 'radio')); $radios[] = &HTML_QuickForm::createElement('radio', null, null, 'label2', 'val2', array('class' => 'radio')); $form->addGroup($radios, 'grp_name', 'Label'); "So, what's wrong with $form->setDefaults(array('grp_name' => 'val1')); preferably done before outputting the form? [1] http://marc.info/?l=pear-general&m=116747045622938&w=2