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

Commit

Permalink
minor symfony#12089 Update multiple_buttons.rst (Romaxx)
Browse files Browse the repository at this point in the history
This PR was submitted for the 4.3 branch but it was merged into the 3.4 branch instead (closes symfony#12089).

Discussion
----------

Update multiple_buttons.rst

Reference to symfony/symfony#32932

Commits
-------

194bca1 Update multiple_buttons.rst
  • Loading branch information
javiereguiluz committed Sep 20, 2019
2 parents 0b4a963 + 194bca1 commit 0d937db
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions form/multiple_buttons.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +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')){

}

0 comments on commit 0d937db

Please sign in to comment.