how to set the selected option in Symfony forms select box

丶灬走出姿态 提交于 2019-12-05 14:53:10

yes, sure — you should have set corresponding form value — either via bind(), either via widget's default option.

For example,

public function configure() 
{
    $this->widgetSchema['field'] = new sfWidgetFormSelect(array(
        "choices" => array('1' => 'test1','2' => 'test2'), 
        'default' => 2));
}

Hope I've answered your question.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!