hi all,

when I iterate over a form that has some validation errors, is it possible 
to access those errors from the form?

something like that would be nice:

{% for field in form %}
  {% if not field.isHidden %}
    <li>
      {% for child in field %}
        {{ form_label(field) }} {{ form_field(field) }} {{ 
form_errors(field) }}
      {% endfor %}
    </li>
  {% endif %}
{% endfor %}

When I iterate over all errors outside the loop above showing the index, the 
error messages aren't related to every field, so when a form has 10 fields, 
5 of them fail to validate, I dont see a way how the error message and the 
field can get a connection.. Also the first example shown here isn't 
working 
http://symfony.com/doc/2.0/book/forms/view.html#defining-the-html-representation
 although 
a normal loop through the form errors shows all:

{% if form.hasErrors %}
  <ul>
    {% for key, error in form.errors %}
      <li>{{ loop.index0 }} {{ key }} {% trans error.messageTemplate with 
error.messageParameters from 'validators' %}</li>
    {% endfor %}
  </ul>
{% endif %}

What am I doing wrong here?
Thanks, Conrad

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to