I've got a functioning form with a sfWidgetFormChoice that acts as a list of checkboxes. I'm able to set the checkboxes to "ticked" by default with the following:
'status' => new sfWidgetFormChoice(array('choices' => array(1, 2, 3), 'multiple' => true, 'expanded' => true), array('checked' => 'checked'))
... where the checkboxes are called "status" and the possible values are 1/2/3.
However, because of something else, instead of ticking them all by default I'd like to be able to control the "checked" status from an action. How do I do this? I've tried everything logical I can think of but I just can't figure out the right syntax.
Basically, I'm looking for something like:
$this->form->getWidget('status')->setAttribute('checked', 'checked');
Anyone?
Thanks.