sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

Error messages displayed twice with form type "sonata_type_native_collection" and "error_bubbling" sets to false #2761

Closed fancyweb closed 4 years ago

fancyweb commented 9 years ago

Admin class :

protected function configureFormFields(FormMapper $formMapper)
{
    $formMapper
        ->add('aliases', 'sonata_type_native_collection', array(
            'type' => 'text',
            'error_bubbling' => false
        ));
}

If validation fails for the field "aliases", the error message will be shown twice.

The first time comes sonata_type_native_collection_widget (https://github.com/sonata-project/SonataAdminBundle/blob/master/Resources/views/Form/form_admin_fields.html.twig#L230), the second time from form_row (https://github.com/sonata-project/SonataAdminBundle/blob/master/Resources/views/Form/form_admin_fields.html.twig#L200).

I think we have to delete the call to form_errors in the sonata_type_native_collection_widget because sonata_type_native_collection_widget is called from form_row.

core23 commented 8 years ago

This issue is very old. Can you please check this against the latest master version?

Feel free to close if you don't use this bundle anymore or the issue is fixed.

nadrshin commented 7 years ago

I use sonata-project/admin-bundle 3.16.0. This bug has not been fixed yet.

Gasjki commented 7 years ago

Did anyone found any solution for this problem ?

nadrshin commented 7 years ago

@ketamina96, add this code to form theme:

{% block sonata_type_native_collection_errors %}
    {% if form.rendered %}
        {{ form_errors(form) }}
    {% endif %}
{% endblock %}
Gasjki commented 7 years ago

@Nadrshin it doesn't work. It still shown twice.

stale[bot] commented 4 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

sad270 commented 2 months ago

Hello, i have same issue on SonataAdminBundle 4.31.0

Screenshot 2024-08-29 at 16 37 40