Re: QuickForm2 - ho
| From: | Alexey Borzov | Date: | Sun, 22 Nov 2009 21:05:50 +0000 |
| Subject: | Re: QuickForm2 - ho | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-53059@lists.php.net to get a copy of this message | ||
Hi Alain,
On Fri, 20 Nov 2009 12:55:29 +0000, Alain Williams <addw@phcomp.co.uk>
wrote:
> I have found that this does not do what I want:
> $tue->setAttribute('checked');
When you add an element to the form or add a datasource to the form with
element added, element will update its value from this datasource
overwriting whatever you set it to previosly.
> I would like to add them all at once:
> $form->addElement('radio', 'Weekdays', array('value' =>
> $d),
> array('label' => "Day $day", 'content' =>
> "content: $d",
> 'options' => $Wdays));
> .... later on specify default:
> $form->addDataSource(new
> HTML_QuickForm2_DataSource_Array('Weekdays' => 'Tue'));
>
> Can I already do something like that ?
You'll have to use a loop to add radios, but addDataSource() call should
work as expected.