-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Description
Documentation is incorrect in:
https://github.com/symfony/symfony-docs/blob/master/form/multiple_buttons.rst
https://symfony.com/doc/current/form/multiple_buttons.html
in code:
$form->getClickedButton()
this method do not exists
if you use example above, that creates $form variable:
$form = $this->createFormBuilder($task)
->add('task', TextType::class)
->add('dueDate', DateType::class)
->add('save', SubmitType::class, ['label' => 'Create Task'])
->add('saveAndAdd', SubmitType::class, ['label' => 'Save and Add'])
->getForm();
return type of $form variable would be FormInterface
and form interface does not contain method getClickedButton
- If method above would return
Form
, which hasgetClieckedButton
method, then
/**
* Returns the button that was used to submit the form.
*
* @return ClickableInterface|null
*/
public function getClickedButton()
returns ClickableInterface
which does not have method getName
used in example:
$form->getClickedButton()->getName()