File tree 2 files changed +23
-0
lines changed
Filter options
2 files changed +23
-0
lines changed
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ on all types for which ``FormType`` is the parent.
19
19
| | - `error_bubbling `_ |
20
20
| | - `error_mapping `_ |
21
21
| | - `extra_fields_message `_ |
22
+ | | - `form_attr `_ |
22
23
| | - `help `_ |
23
24
| | - `help_attr `_ |
24
25
| | - `help_html `_ |
@@ -116,6 +117,8 @@ The actual default value of this option depends on other field options:
116
117
117
118
.. include :: /reference/forms/types/options/extra_fields_message.rst.inc
118
119
120
+ .. include :: /reference/forms/types/options/form_attr.rst.inc
121
+
119
122
.. include :: /reference/forms/types/options/help.rst.inc
120
123
121
124
.. include :: /reference/forms/types/options/help_attr.rst.inc
Original file line number Diff line number Diff line change
1
+ ``form_attr``
2
+ ~~~~~~~~~~~~~
3
+
4
+ **type**: ``boolean`` or ``string `` **default**: ``false ``
5
+
6
+ When ``true `` and used on a form element, it adds a `"form" attribute`_ to its HTML field representation with
7
+ its HTML form id. By doing this, a form element can be rendered outside the HTML form while still working as expected::
8
+
9
+ $builder->add('body' , TextareaType::class, [
10
+ 'form_attr' => true ,
11
+ ]);
12
+
13
+ This can be useful when you need to solve nested form problems.
14
+ You can also set this to ``true `` on a root form to automatically set the "form" attribute on all its children.
15
+
16
+ .. note::
17
+
18
+ When the root form has no ID, ``form_attr`` is required to be a string identifier to be used as the form ID.
19
+
20
+ .. _`"form" attribute`: https:// html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fae-form
You can’t perform that action at this time.
0 commit comments