Symfony2 form_errors

后端 未结 4 770
情书的邮戳
情书的邮戳 2021-02-06 14:51

I think its a simple question. Its about outputting errors. This is my twig file:

    
{{ form_label(form.d
4条回答
  •  遥遥无期
    2021-02-06 15:27

    Another simple solution (tested with symfony 3):

    {% for error in form.username.vars.errors %}
       {{ error.message }} 
    {% endfor %}

    Replace 'username' with your form field.

提交回复
热议问题