@@ -17,6 +17,7 @@ A submit button.
17
17
| | - `label `_ |
18
18
| | - `label_attr `_ |
19
19
| | - `translation_domain `_ |
20
+ | | - `validation_groups `_ |
20
21
+----------------------+----------------------------------------------------------------------+
21
22
| Parent type | :doc: `button</reference/forms/types/button> ` |
22
23
+----------------------+----------------------------------------------------------------------+
@@ -45,6 +46,32 @@ Inherited Options
45
46
46
47
.. include :: /reference/forms/types/options/button_translation_domain.rst.inc
47
48
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 to go 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: `form chapter <book-form-validation-groups >`.
74
+
48
75
Form Variables
49
76
--------------
50
77
0 commit comments