Skip to content

Instantly share code, notes, and snippets.

@smottt
Created January 16, 2012 15:12
Show Gist options
  • Save smottt/1621293 to your computer and use it in GitHub Desktop.
Save smottt/1621293 to your computer and use it in GitHub Desktop.
Check if symfony2 form has errors in a twig template
{% if form.get('errors') is not empty %}
Magic errors display!
{% endif %}
@phillipsnick
Copy link

I have been faffing around for a good half an hour trying to get this working, couldn't get the above examples working. The following works for me though.

{% if form.domain.vars.errors.count() > 0 %}
  Do something
{% endif %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment