0

我添加了额外的选择框(choice type)mapped=>false查看下面的代码。但是,当我提交表格时。它返回了错误消息"This value is not valid."

 $form->add('extraField' ,'choice', array(
            'required' => false,
            'choices' => $arrayChoices,
            'mapped'=>false, 
            'data' =>$id
            ));

我在这里做错了什么?

4

2 回答 2

0

你确定那$id是有效的数组键$arrayChoices吗?

此外,当您提交表单时,请求必须在$arrayChoices

于 2013-10-08T16:02:47.390 回答
0

好的,在此文档之后:http ://symfony.com/doc/current/reference/forms/types/choice.html#choices

我没有看到“数据”选项。请尝试删除它。(而且,这个字段 [data] 有什么用?)

于 2013-10-08T15:43:32.770 回答