Skip to content

Commit 0d4305a

Browse files
author
Iltar van der Berg
committed
Added a small part about named forms
1 parent f3eaa80 commit 0d4305a

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
@@ -702,6 +702,16 @@ the choice is ultimately up to you.
702702

703703
$form->get('dueDate')->setData(new \DateTime());
704704

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

0 commit comments

Comments
 (0)