我正在構建一個以兩個模板顯示的問卷,但我不需要在其中一個模板中顯示一些
$builder
->add('acceptConsent', CheckboxType::class, [
'label_attr' => [
'class' => 'font-weight-bold'
],
'required' => true,
'constraints' => new NotBlank(),
'disabled' => $readOnly,
])
有什么方法可以將表單設定為不呈現欄位?
uj5u.com熱心網友回復:
您可能“只是”不渲染您的form_row或form_widget
并以這種方式關閉您的表單 {{ form_end(form, {'render_rest': false}) }}
因此未渲染的欄位未渲染。
在這里查看更多資訊:https : //symfony.com/doc/current/form/form_customization.html
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/349365.html
下一篇:在PHP中連接兩個值
