8000 Added alternative syntax using getClickedButton() by ThomasLandauer · Pull Request #7931 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Added alternative syntax using getClickedButton() #7931

8000
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
9 changes: 9 additions & 0 deletions form/multiple_buttons.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ querying if the "Save and add" button was clicked::

return $this->redirectToRoute($nextAction);
}

Or you can get the button's name by using the
:method:`Symfony\\Component\\Form\\Form::getClickedButton` method of the form::

if ($form->getClickedButton() && 'saveAndAdd' === $form->getClickedButton()->getName()) {
// ...
}


0