Skip to content

[Form] Improve form validation section #18593

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
Jul 21, 2023
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
9 changes: 5 additions & 4 deletions forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ Before using validation, add support for it in your application:
$ composer require symfony/validator

Validation is done by adding a set of rules, called (validation) constraints,
to a class. You can add them either to the entity class or to the form class.
to a class. You can add them either to the entity class or by using the
:ref:`constraints option <reference-form-option-constraints>` of form types.

To see the first approach - adding constraints to the entity - in action,
add the validation constraints, so that the ``task`` field cannot be empty,
Expand Down Expand Up @@ -567,9 +568,9 @@ object.
That's it! If you re-submit the form with invalid data, you'll see the
corresponding errors printed out with the form.

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>`.
To see the second approach - adding constraints to the form - please refer to
this :ref:`section <form-option-constraints>`.
Both approaches can be used together.

Form Validation Messages
~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down