1

I have a little problem I don't understand. I want to display my errors in the same location at the top of the form, I used form_errors(form)

Then in my form, I added a default value to my fields.

        

$resolver->setDefaults([
    'data_class' => Whitelist::class,
    'error_bubbling' => true
]);

Currently, it does not work and my errors appear in their respective fields.

But if I put this option 'error_bubbling' => true to my field, it works. Why by default it does not work?

->add('firstName', null, [
     'label' => "Prénom de votre personnage",
     'error_bubbling' => true
])

Sorry for my english, thanks.

Beshoy Hanna
  • 611
  • 2
  • 9
  • 29
Scozor
  • 11
  • 3

1 Answers1

0

'error_bubbling' => true means that the error will "bubble" up to the form, where you are trying to display it.

From the docs:

error_bubbling

type: boolean default: false unless the form is compound If true, any errors for this field will be passed to the parent field or form. For example, if set to true on a normal field, any errors for that field will be attached to the main form, not to the specific field.

Beshoy Hanna
  • 611
  • 2
  • 9
  • 29
  • Yes that's the behavior I want to have. I may have misunderstood your answer but I want to assign this property to true on all my default fields without having to assign them manually. – Scozor Nov 26 '19 at 20:44
  • Not sure how to do that. – Beshoy Hanna Nov 26 '19 at 21:38