Anonymous Anonymous - 2 years ago
1001 0

A way to loop through the form errors

Twig

Twig loop through form errors

{% if form.vars.errors is not empty %}
    {% for error in form.vars.errors %}
        {% if error.message == 'My custom error message' %}
            {% set class = "my-custom-text-danger" %}
        {% endif %}
    {% endfor %}
{% endif %}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download