【发布时间】:2012-04-02 09:09:25
【问题描述】:
当表单提交并再次显示刷新后,请求被绑定到表单并显示选定的值。如果之前未提交表单,我想使用来自外部数组(在我的情况下为会话)的数据来水合表单。表单是数组类型,不连接任何实体,作为db过滤器。
我有选择表单域展开,多个(复选框)配置如下:
$categoryForm = array();
$form = $this->createFormBuilder( $categoryForm )
->add( 'id', 'choice', array( 'choices' => $arrayOfChoices,
'multiple' => true,
'expanded' => true ) )
->getForm();
if ( $request->getMethod() == 'POST' ) {
$form->bindRequest( $request );
}
【问题讨论】: