QuickForm2: Checkboxes addDataSource in Wizzard
| From: | Cedrick Gout | Date: | Sun, 06 Feb 2011 14:45:06 +0000 |
| Subject: | QuickForm2: Checkboxes addDataSource in Wizzard | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-30948@lists.php.net to get a copy of this message | ||
When trying to apply addDataSource to a checkbox in the QF2 Wizzard the value doesn't seem to
get set correctly.
Below is my example code, I copied the checkbox and radio from the basic-elements.php example file.
In my example I only used the radio and checkbox, the radio button does get set correctly but the
radio doesn't. (Other elements from the basic-elemenst file seem to get set correctly as well)
Is this a bug or a mistake on my behalf?
Best regards,
Cedrick
class PageThird extends HTML_QuickForm2_Controller_Page
{
protected function populateForm()
{
// data source with default values:
$this->form->addDataSource(new HTML_QuickForm2_DataSource_Array(array(
'boxTest' => '1',
'radioTest' => '2'
)));
// checkboxes and radios
$fsCheck = $this->form->addElement('fieldset')->setLabel('Checkboxes and
radios');
$fsCheck->addElement(
'checkbox', 'boxTest', null, array('content' => 'check
me', 'label' => 'Test Checkbox:')
);
$fsCheck->addElement(
'radio', 'radioTest', array('value' => 1),
array('content' => 'select radio #1', 'label' => 'Test
radio:')
);
$fsCheck->addElement(
'radio', 'radioTest', array('value' => 2),
array('content' => 'select radio #2', 'label' =>
'(continued)')
);
}
}