Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Minor formatting changes
  • Loading branch information
javiereguiluz authored May 21, 2017
commit 7ecff6463d907a3e914e0c63bb05fe8e49fa6376
4 changes: 3 additions & 1 deletion form/multiple_buttons.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ querying if the "Save and add" button was clicked::
Or you can get the button's name by using the
:method:`Symfony\\Component\\Form\\Form::getClickedButton` method of the form::

if ($form->getClickedButton()->getName()==='saveAndAdd')
if ('saveAndAdd' === $form->getClickedButton()->getName()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to be careful here. Depending on how the form was submitted getClickedButton() may return null. Then, this example would run into an error as getName() could not be executed.

// ...
}