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

Skip to content

Commit 60f5034

Browse files
KamilKubickijaviereguiluz
authored andcommitted
Update direct_submit.rst
Updating the rules for payload data submission - payload fields should equal FormType class describing the Form structure
1 parent dc6872c commit 60f5034

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

form/direct_submit.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,12 @@ control over when exactly your form is submitted and what data is passed to it::
5959

6060
// 'email' and 'username' are added manually to force their validation
6161
$form->submit(array_merge(['email' => null, 'username' => null], $request->request->all()), false);
62+
63+
.. caution::
64+
65+
When submitting a form via a "POST" request and manually submitting the form
66+
with ``submit()``, ensure that list of fields in payload equals the list of validated
67+
fields in FormType class - in other case the form validation will fail.
68+
69+
//'json' represents payload data (used frequently by api client as React/Angular/Vue etc.)
70+
$form->submit(array_merge($json, $request->request->all()));

0 commit comments

Comments
 (0)