Reputation: 66
I want to use the sfWidgetFormSelectMany inside a sfForm. I have no problems setting the choices for the select, but how do I set the selected values when loading the form?
This is my code for the sfWidgetFormSelectMany so far:
$choices = $this->getScopes();
$this->widgetSchema['application_scopes'] = new sfWidgetFormSelectMany(array(
'choices' => $choices
));
$this->validatorSchema['application_scopes'] = new sfValidatorChoiceMany(array(
'choices' => array_keys($choices)
));
Upvotes: 0
Views: 61
Reputation: 66
So, I have to answer the question by myself. Sometimes the best way is to ask a question to find the answer ;-)
As I am inside my form class, I just can set the values like this:
$this->setDefault('application_scopes', array('this','that'));
Upvotes: 1