Skip to content

Commit 0d10261

Browse files
Iltar van der Berglinaori
authored andcommitted
Added a small part about named forms
1 parent 0665ada commit 0d10261

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

forms.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,16 @@ the choice is ultimately up to you.
699699

700700
$form->get('agreeTerms')->setData(true);
701701

702+
Rendering the Same Form Multiple Times on the Same Page
703+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
704+
705+
In some situations you might find yourself in need of having the same form on
706+
the same page multiple times. By default, a form name is based off the class of
707+
the form type. To differentiate between the forms, you can create a form using
708+
:method:`FormFactoryInterface::createNamed() <Symfony\\Component\\Form\\FormFactoryInterface>`.
709+
Doing so, will change the html name of the form and Symfony will be able to see
710+
which of the forms was submitted, and handle it accordingly.
711+
702712
Final Thoughts
703713
--------------
704714

0 commit comments

Comments
 (0)