如何使用twig
添加所需的表格行我已经使用了此代码,但是提交时不起作用
{{ form_row(form.prenom,{'attr': {'required': 'required'} }) }}
控制器
$candidat = new Candidat();
$form = $this->createForm(CandidatType::class, $candidat);
;
$this->render("cvtheque/ajouter_candidat.html.twig",['form' => $form->createView()])
您应该在形式的建筑物上指定它:
->add('prenom', TextType::class, [
'label' => 'customer.edit.firstname',
'required' => true
])