EasyAdminBundle: Using form->addError , the message is displayed twice
Describe the bug
I have a custom action , with a custom path, that display a custom form to import a CSV, as the errors are not related to one specific field of the form, I use the $form->addError(new FormError()) to attach the error to the form
I then display it using simply in twig {{ form(form) }} and then the error get displayed twice

Though the form has correctly only one error

To Reproduce
version 3.1.9
(OPTIONAL) Additional context If they are useful, include logs, code samples, screenshots, etc.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 21
@xabbuh in some hours I will make a small project on github with both use cases , thanks for your time.
thanks for the PR and the investigation 😃
Thanks, this helped a lot. 👍 After looking into it I found the root cause here: For all the form types provided by the CRUD logic of this bundle the
CrudFormTypeis used which definesea_crudas the block prefix. This means that its widgets are rendered by theea_crud_widgetwhich currently does not render form errors. For all other form types this block prefix is not set which means that the core Symfony widgets will be used which (since #4025) correctly render the errors.