Simple check if form field has errors in Twig template

后端 未结 10 1663
一个人的身影
一个人的身影 2021-01-30 08:11

In Twig template I check if a field has an error like this:

{% if form.points.get(\'errors\') is not empty %}

Is there any method like:

10条回答
  •  再見小時候
    2021-01-30 09:03

    If you are using symfony 4, you can check errors existence with this code

    {% if form_errors(registrationForm) %}
        
    {{ form_errors(registrationForm) }}
    {% endif %}

提交回复
热议问题