We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 362b2fd + 4005b8f commit 4f1d4a8Copy full SHA for 4f1d4a8
form/direct_submit.rst
@@ -34,6 +34,24 @@ control over when exactly your form is submitted and what data is passed to it::
34
]);
35
}
36
37
+The list of fields submitted with the ``submit()`` method must be the same as
38
+the fields defined by the form class. Otherwise, you'll see a form validation error::
39
+
40
+ public function new(Request $request): Response
41
+ {
42
+ // ...
43
44
+ if ($request->isMethod('POST')) {
45
+ // '$json' represents payload data sent by React/Angular/Vue
46
+ // the merge of parameters is needed to submit all form fields
47
+ $form->submit(array_merge($json, $request->request->all()));
48
49
50
+ }
51
52
53
54
55
.. tip::
56
57
Forms consisting of nested fields expect an array in
0 commit comments