HTML Form Multiple Submit Buttons, Different Actions

Written on 28 Mar 2013

I've often wondered as to the best way of having two form buttons that can submit but yield slightly different actions.  Turns out HTML5 scratches that itch with the `formaction` attribute.

The formaction attribute specifies the URL of a file that will process the input control when the form is submitted.

In my case, it's going to the same (Sinatra) controller action route, but by appending a simple URL parameter (`?action=this`) you can modify the response/control to change behaviour accordingly.

Simples

Check it out on W3Schools

Copyright © 2006 - 2019 Kester Dobson

WIP