Search code examples
htmlformsnoscript

html form with two actions depending on submit button


similar to this question, but for when you do not have control of the backend: HTML form with multiple "actions"

supposed i have an UI:

[input field       ] [button A] [button B]

let's say button A should go to ://another.company.com/edit?input_field and button B must go to ://yet.another.company.com/delete?confirmation=yes&input_field

I already have the javascript solution in place. and for no-script users i am creating a single target script that reads which submit button was pressed and respond with a HTTP 302 to the right url, so i can make it work with a single html form action... but is there a solution that uses only HTML? Don't care if it is not html4 compatible.

meta comment: please, do not add answers saying "no". I already know that. this is an exploratory question to see if there is any clever trick or obscure standard. I know the consensus is that it is not possible already and my question even includes the most practical work-around already. thank you!


Solution

  • What about the formaction attribute of the <input>?

    https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/button