Hi,

A bit shorter version of my question: I have a form with a subform
called enterprise.

How can I print the field validation errors with twig? E.g.
{{ form_errors(form.enterprise.username) }} does not work for the
field username.

Andras

On febr. 15, 11:42, Andras <are...@epiac.hu> wrote:
> Hi,
>
> I'm trying to print the error messages for the fields of the subform
> called enterprise in twig:
>
> If I do it like this no messages appear (except for
> form_errors(form.termsAccepted)):
>
>     {{ form_errors(form) }}<br>
>     {{ form_errors(form.enterprise.username) }}<br>
>     {{ form_label(form.enterprise.username) }}:<br>
>     {{ form_field(form.enterprise.username) }}<br>
>     {{ form_errors(form.enterprise.contact_name) }}<br>
>     {{ form_label(form.enterprise.contact_name) }}:<br>
>     {{ form_field(form.enterprise.contact_name) }}<br>
>     {{ form_errors(form.enterprise.contact_email) }}<br>
>     {{ form_label(form.enterprise.contact_email) }}:<br>
>     {{ form_field(form.enterprise.contact_email) }}<br>
>     {{ form_errors(form.enterprise.password.first) }}<br>
>     {{ form_label(form.enterprise.password.first) }}:<br>
>     {{ form_field(form.enterprise.password.first) }}<br>
>     {{ form_errors(form.enterprise.password.second) }}<br>
>     {{ form_label(form.enterprise.password.second) }}:<br>
>     {{ form_field(form.enterprise.password.second) }}<br>
>     {{ form_errors(form.termsAccepted) }}<br>
>     {{ form_field(form.termsAccepted) }}
> {{ form_label(form.termsAccepted) }}<br>
>     {{ form_hidden(form) }}
>
> If I write {{ form_errors(form.enterprise) }} to the top it shows all
> of the subform error messages at once at the top of the form. Is this
> a bug or am I doing something the wrong way?
>
> Andras

-- 
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