Boris
Boris

Reputation: 166

Can't display form_errors

I can't display all form errors with form_errors(form). But I can display them one by one.

Here is my entities with the constraints :

Locale

property "locale" (@Assert\Length) it's a string

LocaleTranslation extends Translation

property "locale" (@Assert\Valid) (it's a ManyToOne with Locale) it's an object

abstract class Translation value (@Assert\NotBlank) it's a string

My form type is based on LocaleTranslation.

This code works :

  {{ form_errors(form.locale.locale) }}
  {{ form_errors(form.value) }}

But not this one :

  {{ form_errors(form) }}

Any idea ?

Upvotes: 0

Views: 85

Answers (1)

Carlos Granados
Carlos Granados

Reputation: 11351

If you want, you can use "Error bubbling". You can mark your fields with:

'error_bubbling'  => true

And then any error for this field will be assigned to its parent form.

More information here:

http://symfony.com/doc/current/reference/forms/types/form.html#error-bubbling

Upvotes: 0

Related Questions