I have 2 submit buttons in my form and I’m trying to make each one go to a different controller method. I’m trying not avoid the use of multiple forms.
I’m currently using
<button type="submit" onclick="javascript: form.action='restore'">Restore</button>
<button type="submit" onclick="javascript: form.action='delete'">Delete</button>
…which works but I’m not sure if that’s the best method. Any thoughts?
Usually I’d like to handle the multiple submits by giving button/input tag a name attr. In this way you can submit and call to one function/action in one same controller, just by checking which button was submitted.
e.g:
Then in your controller, there will be a function called “process” doing this:
Hope this would help.