我正在使用"required"=> false的单选按钮.这使得"无"选项与我的其他选择一起出现.
如何自定义此标签(假设我想显示"null"而不是"none")?
Moh*_*yan 12
如果要删除它,请设置placeholder为false
->add('color', ChoiceType::class, array(
'choices' => array('Red' => 1, 'Blue' => 2, 'Green' => 3),
'expanded' => true,
'required' => false,
'placeholder' => false
));
Run Code Online (Sandbox Code Playgroud)
yce*_*uto 10
使用placeholder选项更改"无"无线电输入的标签:
->add('color', ChoiceType::class, array(
'choices' => array('Red' => 1, 'Blue' => 2, 'Green' => 3),
'expanded' => true,
'required' => false,
'placeholder' => 'Null', // <---- \o/
));
Run Code Online (Sandbox Code Playgroud)
预习:
占位符选项是在Symfony 2.6(doc)中引入的
| 归档时间: |
|
| 查看次数: |
2479 次 |
| 最近记录: |