From 194bca153b6824a48f7c43511cc517928f778d26 Mon Sep 17 00:00:00 2001 From: Romaxx <8945610+Romaxx@users.noreply.github.com> Date: Mon, 5 Aug 2019 11:20:58 +0200 Subject: [PATCH] Update multiple_buttons.rst --- form/multiple_buttons.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/form/multiple_buttons.rst b/form/multiple_buttons.rst index 1965e941f62..18a34769489 100644 --- a/form/multiple_buttons.rst +++ b/form/multiple_buttons.rst @@ -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')){ + + }