Sonataadminbundle: Improve the global form errors

Created on 26 Aug 2016  ·  9Comments  ·  Source: sonata-project/SonataAdminBundle

Environment

Sonata 3.x

Sonata packages

sonata-project/admin-bundle              3.4.0              The missing Symfony Admin Generator
sonata-project/block-bundle              3.1.1              Symfony SonataBlockBundle
sonata-project/cache                     1.0.7              Cache library
sonata-project/cache-bundle              2.2.5              This bundle provides caching services
sonata-project/classification-bundle     3.1.0              Symfony SonataClassificationBundle
sonata-project/core-bundle               3.0.3              Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.2                Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.0.2              Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.0.5              Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.1.10             Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.7.0              Lightweight Exporter library
sonata-project/formatter-bundle          3.0.1              Symfony SonataFormatterBundle
sonata-project/google-authenticator      1.0.2              Library to integrate Google Authenticator into a PHP project
sonata-project/intl-bundle               2.2.4              Symfony SonataIntlBundle
sonata-project/media-bundle              3.2.0              Symfony SonataMediaBundle
sonata-project/notification-bundle       3.0.0              Symfony SonataNotificationBundle
sonata-project/page-bundle               3.1.0              This bundle provides a Site and Page management through contain...
sonata-project/seo-bundle                2.0.2              Symfony SonataSeoBundle
sonata-project/user-bundle               3.0.1              Symfony SonataUserBundle

Subject

Currently a message Bootstrap3 designed, is prompted when an error occured.
But when you want to prompt an other one, you need going through flash messages, that IMO not the right way.

What do think if I applied this style on {{ form_errors(form) }} too ? An alert dismiss style.

Steps to reproduce

Create a new page page in sonata page, submit, you git now an unique url error prompted at the top.

Expected results

Standardize form errors

Actual results

capture d ecran 2016-08-26 a 11 58 24

bug

Most helpful comment

capture d ecran 2016-08-26 a 15 19 17

All 9 comments

Hmmm… shouldn't he url error message be near the "url" field?

I'm not sure about, because this append when you didn't select a parent page for exemple.

Which would make that an error which is global to the form? Ok… but anyway, I think it would be better indeed to have the same style instead of this patchwork.

Probably the unique url validation constraint message can be improved too.

For example, "you probably messed to select a parent page", when the url is /.
Attached too the parent page field.

And if a parent is selected, attach the error to the url field, or slug or URL personnalized.

If someone else can give his opinion, i will work on it this afternoon

ping @sonata-project/contributors

capture d ecran 2016-08-26 a 15 19 17

Now i'm going to modify the behavior of the unique url constraint.

PR are merged and released 👍

Was this page helpful?
0 / 5 - 0 ratings