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

Skip to content

Commit b6286fd

Browse files
committed
Merge branch '2.5'
* 2.5: formatting to follow 72 characters line limit changed dash to underscore change misleading language identifier add description for the `validation_groups` option
2 parents 5d505bb + aac823e commit b6286fd

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

book/forms.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,8 @@ fields were submitted. If you want to suppress validation, you can use the
504504
.. index::
505505
single: Forms; Validation groups based on submitted data
506506

507+
.. _book-form-validation-groups:
508+
507509
Groups based on the Submitted Data
508510
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
509511

reference/forms/types/language.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ The ``language`` type is a subset of the ``ChoiceType`` that allows the user
88
to select from a large list of languages. As an added bonus, the language names
99
are displayed in the language of the user.
1010

11-
The "value" for each language is the *Unicode language identifier*
12-
(e.g. ``fr`` or ``zh-Hant``).
11+
The "value" for each language is the *Unicode language identifier* used in
12+
the `International Components for Unicode`_ (e.g. ``fr`` or ``zh_Hant``).
1313

1414
.. note::
1515

@@ -106,3 +106,5 @@ The actual default value of this option depends on other field options:
106106
.. include:: /reference/forms/types/options/read_only.rst.inc
107107

108108
.. include:: /reference/forms/types/options/required.rst.inc
109+
110+
.. _`International Components for Unicode`: http://site.icu-project.org

reference/forms/types/submit.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ A submit button.
1717
| | - `label`_ |
1818
| | - `label_attr`_ |
1919
| | - `translation_domain`_ |
20+
| | - `validation_groups`_ |
2021
+----------------------+----------------------------------------------------------------------+
2122
| Parent type | :doc:`button</reference/forms/types/button>` |
2223
+----------------------+----------------------------------------------------------------------+
@@ -45,6 +46,33 @@ Inherited Options
4546

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

49+
validation_groups
50+
~~~~~~~~~~~~~~~~~
51+
52+
**type**: ``array`` **default**: ``null``
53+
54+
When your form contains multiple submit buttons, you can change the validation
55+
group based on the button which was used to submit the form. Imagine a registration
56+
form wizard with buttons to go to the previous or the next step::
57+
58+
$form = $this->createFormBuilder($user)
59+
->add('previousStep', 'submit', array(
60+
'validation_groups' => false,
61+
))
62+
->add('nextStep', 'submit', array(
63+
'validation_groups' => array('Registration'),
64+
))
65+
->getForm();
66+
67+
The special ``false`` ensures that no validation is performed when the previous
68+
step button is clicked. When the second button is clicked, all constraints
69+
from the "Registration" are validated.
70+
71+
.. seealso::
72+
73+
You can read more about this in :ref:`the Form chapter <book-form-validation-groups>`
74+
of the book.
75+
4876
Form Variables
4977
--------------
5078

0 commit comments

Comments
 (0)