Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@javiereguiluz
Copy link
Member

I'm going to revamp the docs about Symfony Forms. I'll do that in several small PRs. This is the first one, which does a basic cleanup by merging tiny separate articles into the main forms article.

To achieve this, use the ``expression`` option of the
:doc:`When constraint </reference/constraints/When>` to reference the other field::

use Symfony\Component\Validator\Constraints as Assert;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why the validator fails in this ... this import works and it's the same in all the other examples in the docs.

@javiereguiluz
Copy link
Member Author

I'm going to merge this PR because it's only about moving contents around, not adding/changing contents. But, for the next form PRs, I'll need reviews from Symfony Form experts 🙏 Thanks!

@javiereguiluz javiereguiluz merged commit b2e6122 into symfony:6.4 Jan 22, 2026
@javiereguiluz javiereguiluz deleted the forms_1 branch January 22, 2026 07:17
javiereguiluz added a commit that referenced this pull request Jan 22, 2026
…iluz)

This PR was merged into the 6.4 branch.

Discussion
----------

[Form] Fixed references to some removed pages

I forgot to update this in #21740. Sorry!

Commits
-------

9408b54 [Form] Fixed references to some removed pages
->add('lastName', TextType::class)
->getForm();

Conditional Constraints
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another way to do that is to configure the validation_groups option of the form with a callable. This is currently documented in https://symfony.com/doc/current/form/validation_groups.html but it might deserve a link from here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your review! I'm adding this in #21791. Thanks.

javiereguiluz added a commit that referenced this pull request Jan 29, 2026
…on groups (javiereguiluz)

This PR was merged into the 6.4 branch.

Discussion
----------

[Form] Mention conditional constraints via form validation groups

As mentioned in #21740 (review)

Commits
-------

9fb0224 [Form] Mention conditional constraitns via form validation groups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants