Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Reference] add description for thevalidation_groups option#4246

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
weaverryan merged 1 commit intosymfony:2.3fromxabbuh:issue-3358
Oct 3, 2014
Merged
Show file tree
Hide file tree
Changes fromall 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
2 changes: 2 additions & 0 deletionsbook/forms.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -504,6 +504,8 @@ fields were submitted. If you want to suppress validation, you can use the
.. index::
single: Forms; Validation groups based on submitted data

.. _book-form-validation-groups:

Groups based on the Submitted Data
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
28 changes: 28 additions & 0 deletionsreference/forms/types/submit.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,6 +17,7 @@ A submit button.
| | - `label`_ |
| | - `label_attr`_ |
| | - `translation_domain`_ |
| | - `validation_groups`_ |
+----------------------+----------------------------------------------------------------------+
| Parent type | :doc:`button</reference/forms/types/button>` |
+----------------------+----------------------------------------------------------------------+
Expand DownExpand Up@@ -45,6 +46,33 @@ Inherited Options

.. include:: /reference/forms/types/options/button_translation_domain.rst.inc

validation_groups
~~~~~~~~~~~~~~~~~

**type**: ``array`` **default**: ``null``

When your form contains multiple submit buttons, you can change the validation
group based on the button which was used to submit the form. Imagine a registration
form wizard with buttons to go to the previous or the next step::

$form = $this->createFormBuilder($user)
->add('previousStep', 'submit', array(
'validation_groups' => false,
))
->add('nextStep', 'submit', array(
'validation_groups' => array('Registration'),
))
->getForm();

The special ``false`` ensures that no validation is performed when the previous
step button is clicked. When the second button is clicked, all constraints
from the "Registration" are validated.

.. seealso::

You can read more about this in :ref:`the Form chapter <book-form-validation-groups>`
of the book.

Form Variables
--------------

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp