我在symfony框架中的checkboxtype有问题。我的创建表单代码是:
$form = $this->createFormBuilder()
->add('table_records', CheckboxType::class)
->add('save', SubmitType::class, array('label' => 'delete'))
->getForm();
Run Code Online (Sandbox Code Playgroud)
我的问题是复选框中的数组,因为对于许多复选框,我都需要复选框名称,例如table_records []。
将ChoiceType与和一起使用,并设置expanded为true。
$builder->add('table_records', ChoiceType::class, array(
'choices' => array(),
'expanded' => true
))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2406 次 |
| 最近记录: |