I have added a second submit button to my form, now Symfony2 complains about it: "This form should not contain extra fields"
Although I added this option in the formtype:
public function getDefaultOptions(array $options)
{
return array(
'csrf_protection' => false,
);
}
Any ideas?
You can most certainly have multiple submit buttons. Make sure the button is not in the same array as the other form fields.
So, for example, if your form fields have a name
FormType[field_name]
, you can't haveFormType[submit_btn]
as the name of the button and you must choose a different one.Your controller can act differently depending on the button pressed. If your submit buttons are named
submit_1
andsubmit_2
you can have something similar to