Specific checkboxes checked in symfony 1.4

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2010-03-21T19:06:37Z Indexed on 2010/03/21 19:11 UTC
Read the original article Hit count: 489

Filed under:
|
|

Hi,

I'm able to do the following for all checkboxes in a set (in an action):

$this->form->getWidget('some_form_field')->setAttribute('checked', 'checked');

... but I'm unable to set specific checkboxes to ticked on the basis of data returned from the db.

I'm after something like:

$this->form->getWidget('some_form_field')->setAttributes(array(....));

... where I can refer to the specific checkboxes to be ticked somehow, or pass an array to it.

There's nothing in the symfony documentation on this specifically and I've had enough of trying a dozen combinations to get it work.

Any help would be appreciated.

Thanks.

© Stack Overflow or respective owner

Related posts about symfony

Related posts about form