I've got a form class with a checkbox widget:
$this->setWidgets(array(
'status' => new sfWidgetFormInputCheckbox(array('value_attribute_value' => 1)),
// various other widgets
));
Is there a way to set this checkbox to unticked from inside the form class (it's checked by default)? I can't seem to get anything to work. I found something on Google that this might be a Symfony bug that just hasn't been fixed but I'm refusing to believe it.
Setting it from the action works fine:
$this->form->setDefault('status', false);
... but I'd prefer not to have it there.
Try setting the default value at the end of the configure()
method of your form, it should work :
$this->setDefault('status', false);