@@ -560,46 +560,51 @@ To see the second approach - adding constraints to the form - and to
560560learn more about the validation constraints, please refer to the
561561:doc: `Symfony validation documentation </validation >`.
562562
563+ Form Validation Messages
564+ ~~~~~~~~~~~~~~~~~~~~~~~~
565+
563566.. versionadded :: 5.2
564567
565- In Symfony 5.2, the form validation messages have been rewritten to be more
566- user-friendly. Set the ``legacy_error_messages `` option to ``false `` to
567- enable these new messages:
568+ The ``legacy_error_messages `` option was introduced in Symfony 5.2
568569
569- .. configuration-block ::
570+ The form types have default error messages that are more clear and
571+ user-friendly than the ones provided by the validation constraints. To enable
572+ these new messages set the ``legacy_error_messages `` option to ``false ``:
573+
574+ .. configuration-block ::
570575
571- .. code-block :: yaml
576+ .. code-block :: yaml
572577
573- # config/packages/framework.yaml
574- framework :
575- form :
576- legacy_error_messages : false
578+ # config/packages/framework.yaml
579+ framework :
580+ form :
581+ legacy_error_messages : false
577582
578- .. code-block :: xml
583+ .. code-block :: xml
579584
580- <!-- config/packages/framework.xml -->
581- <?xml version =" 1.0" encoding =" UTF-8" ?>
582- <container xmlns =" http://symfony.com/schema/dic/services"
583- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
584- xmlns : framework =" http://symfony.com/schema/dic/symfony"
585- xsi : schemaLocation =" http://symfony.com/schema/dic/services
586- https://symfony.com/schema/dic/services/services-1.0.xsd
587- http://symfony.com/schema/dic/symfony
588- https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
585+ <!-- config/packages/framework.xml -->
586+ <?xml version =" 1.0" encoding =" UTF-8" ?>
587+ <container xmlns =" http://symfony.com/schema/dic/services"
588+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
589+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
590+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
591+ https://symfony.com/schema/dic/services/services-1.0.xsd
592+ http://symfony.com/schema/dic/symfony
593+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
589594
590- <framework : config >
591- <framework : form legacy-error-messages =" false" />
592- </framework : config >
593- </container >
595+ <framework : config >
596+ <framework : form legacy-error-messages =" false" />
597+ </framework : config >
598+ </container >
594599
595- .. code-block :: php
600+ .. code-block :: php
596601
597- // config/packages/framework.php
598- $container->loadFromExtension('framework', [
599- 'form' => [
600- 'legacy-error-messages ' => false,
601- ],
602- ]);
602+ // config/packages/framework.php
603+ $container->loadFromExtension('framework', [
604+ 'form' => [
605+ 'legacy_error_messages ' => false,
606+ ],
607+ ]);
603608
604609 Other Common Form Features
605610--------------------------
0 commit comments