Skip to content

[Form] Fixed the layout in the forms page #14589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 35 additions & 30 deletions forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -560,46 +560,51 @@ To see the second approach - adding constraints to the form - and to
learn more about the validation constraints, please refer to the
:doc:`Symfony validation documentation </validation>`.

Form Validation Messages
~~~~~~~~~~~~~~~~~~~~~~~~

.. versionadded:: 5.2

In Symfony 5.2, the form validation messages have been rewritten to be more
user-friendly. Set the ``legacy_error_messages`` option to ``false`` to
enable these new messages:
The ``framework.form.legacy_error_messages`` option was introduced in Symfony 5.2

.. configuration-block::
The form validation messages have been rewritten to be more user-friendly.
To enable these new messages set the ``legacy_error_messages`` option in ``framework``,
``form`` to ``false``:

.. configuration-block::

.. code-block:: yaml
.. code-block:: yaml

# config/packages/framework.yaml
framework:
form:
legacy_error_messages: false
# config/packages/framework.yaml
framework:
form:
legacy_error_messages: false

.. code-block:: xml
.. code-block:: xml

<!-- config/packages/framework.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services
https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<!-- config/packages/framework.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services
https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config>
<framework:form legacy-error-messages="false"/>
</framework:config>
</container>
<framework:config>
<framework:form legacy-error-messages="false"/>
</framework:config>
</container>

.. code-block:: php
.. code-block:: php

// config/packages/framework.php
$container->loadFromExtension('framework', [
'form' => [
'legacy-error-messages' => false,
],
]);
// config/packages/framework.php
$container->loadFromExtension('framework', [
'form' => [
'legacy_error_messages' => false,
],
]);

Other Common Form Features
--------------------------
Expand Down