我想在一个sfWidgetFormSelectMany中使用sfForm。设置select的选项没有问题,但是在加载表单时如何设置选定的值?
到目前为止,这是我的sfWidgetFormSelectMany代码:
$choices = $this->getScopes();
$this->widgetSchema['application_scopes'] = new sfWidgetFormSelectMany(array(
'choices' => $choices
));
$this->validatorSchema['application_scopes'] = new sfValidatorChoiceMany(array(
'choices' => array_keys($choices)
));发布于 2016-04-19 08:29:40
所以,我必须自己回答这个问题。有时最好的方法是问一个问题来找到答案;-)
由于我在表单类中,所以我只需设置如下的值:
$this->setDefault('application_scopes', array('this','that'));https://stackoverflow.com/questions/36710735
复制相似问题