我正在使用Symfony表单,并且试图删除出现的标签或将其更改为接受空格的文本行。在这种情况下,标签为Response a,这是表单的名称。
实体:
protected $responseA;
public function getResponseA()
{
return $this->responseA;
}
public function setResponseA($responseA)
{
$this->task = $responseA;
}
控制器形式:
$responseA = new Applicant();
$responseA->setResponseA('');
$form = $this->createFormBuilder($responseA)
->add('responseA', ChoiceType::class, array(
'choices' => array(
'Very Acceptable' => '1',
'Acceptable' => '2',
'Inappropriate' => '3',
'Very Inappropriate' => '4'
),
))
->add('save', SubmitType::class, array('label' => 'Create Post'))
->getForm();
我要删除或更改的内容:
将'label'值设置为false将抑制标签显示。
$ responseA =新的Applicant(); $ responseA-> setResponseA('');
$form = $this->createFormBuilder($responseA)
->add('responseA', ChoiceType::class, array(
'choices' => array(
'Very Acceptable' => '1',
'Acceptable' => '2',
'Inappropriate' => '3',
'Very Inappropriate' => '4'
),
'label' => false,
))
->add('save', SubmitType::class, array('label' => 'Create Post'))
->getForm();
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句