[英]How to change default name in form Symfony2
I have this builder at FormType class: 我在FormType类中有这个生成器:
$builder
->add('fkTblSources', 'entity', array(
'class' => 'BlaBlaBundle:TblSources',
'property' => 'name',
))
->add('save', 'submit');`
This form shows "fkTblSources"
as name of row. 此表单将
"fkTblSources"
显示为行名。 I need to put this name because it is the field name of the entity "TblTicket" that i want to create with this form. 我需要输入此名称,因为它是我要使用此表单创建的实体“ TblTicket”的字段名称。
How can I change this name? 如何更改这个名字?
Ok, it's easy, sorry. 好吧,很简单,抱歉。
Name of field is changed by 'label' option. 字段名称由“标签”选项更改。
->add('fkTblSources', 'entity', array( 'class' => 'BlaBlaBundle:TblSources', 'property' => 'name', 'label' => 'name for field here' ))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.