@@ -19,6 +19,7 @@ on all types for which ``FormType`` is the parent.
1919| | - `error_bubbling `_|
2020| | - `error_mapping `_|
2121| | - `extra_fields_message `_|
22+ | | - `force_submit `_|
2223| | - `inherit_data `_|
2324| | - `invalid_message `_|
2425| | - `invalid_message_parameters `_|
@@ -94,6 +95,62 @@ The actual default value of this option depends on other field options:
9495
9596..include ::/reference/forms/types/options/extra_fields_message.rst.inc
9697
98+ force_submit
99+ ~~~~~~~~~~~~
100+
101+ ..versionadded ::2.6
102+ The ``force_submit `` option was introduced in Symfony 3.1.
103+
104+ **type **: ``bool `` **default **: ``false ``
105+
106+ By default when an array of data is built from request parameters in a
107+ :class: `Symfony\C omponent\F orm\R equestHandlerInterface ` the name of the form
108+ must match a parameter key so the data can be submitted to it.
109+
110+ This option allow request handlers to force the submission of data to a form
111+ when its name is not among the request parameters.
112+
113+ ..code-block ::php
114+
115+ // Normal submission
116+ $request->request->set('my_form' => array(
117+ 'name' => 'John Doe',
118+ 'email' => 'john@foo.com',
119+ ),
120+ );
121+
122+ $form = $formFactory->createNamedBuilder('my_form')
123+ ->add('name')
124+ ->add('email', EmailType::class)
125+ ->getForm();
126+
127+ $form->handleRequest($request);
128+
129+ // Forced submission
130+ $request->request->set('name', 'John Doe');
131+ $request->request->set('email', 'john@foo.com');
132+
133+ $form = $formFactory->createNamedBuilder('my_form', null, array(
134+ 'force_submit' => true,
135+ ))
136+ ->add('name')
137+ ->add('email', EmailType::class)
138+ ->getForm();
139+
140+ $form->handleRequest($request);
141+
142+ ..note ::
143+
144+ This option is meant to be used with root forms such as default one,
145+ or custom form types.
146+ If this option is true in a nested form or field, it will have no
147+ effect on the submission process.
148+
149+ ..tip ::
150+
151+ This can be useful when using an API as you don't need to nest the data
152+ in an array with the form name as key.
153+
97154..include ::/reference/forms/types/options/inherit_data.rst.inc
98155
99156..include ::/reference/forms/types/options/invalid_message.rst.inc