Skip to content

Commit 0d937db

Browse files
committed
minor #12089 Update multiple_buttons.rst (Romaxx)
This PR was submitted for the 4.3 branch but it was merged into the 3.4 branch instead (closes #12089). Discussion ---------- Update multiple_buttons.rst Reference to symfony/symfony#32932 Commits ------- 194bca1 Update multiple_buttons.rst
2 parents 0b4a963 + 194bca1 commit 0d937db

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

form/multiple_buttons.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,9 @@ Or you can get the button's name by using the
3535
if ($form->getClickedButton() && 'saveAndAdd' === $form->getClickedButton()->getName()) {
3636
// ...
3737
}
38+
39+
If you have multiple buttons with the same name, each nested in multiple subforms, use direct reference instead the name to get the right button
40+
41+
if ($form->getClickedButton() && $form->getClickedButton() === $form->get('saveAndAdd')){
42+
43+
}

0 commit comments

Comments
 (0)