Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Minor reword
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Sep 20, 2019
1 parent 0d937db commit 4b76812
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions form/multiple_buttons.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ Or you can get the button's name by using the
if ($form->getClickedButton() && 'saveAndAdd' === $form->getClickedButton()->getName()) {
// ...
}
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

if ($form->getClickedButton() && $form->getClickedButton() === $form->get('saveAndAdd')){

// when using nested forms, two or more buttons can have the same name;
// in those cases, compare the button objects instead of the button names
if ($form->getClickedButton() === $form->get('saveAndAdd')){
// ...
}

0 comments on commit 4b76812

Please sign in to comment.