0

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!

Community
  • 1
  • 1
gcb
  • 13,901
  • 7
  • 67
  • 92

1 Answers1

2

What about the formaction attribute of the <input>?

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

user2926055
  • 1,963
  • 11
  • 10
  • use an onclick function of the buttons to dynamically alter the action attribute of the form before submitting it. – gavgrif Mar 10 '16 at 00:22
  • 2
    @gavgrif The OP specifically says no script. `onclick` is a script. From looking at the docs, this appears to be the correct answer. – Jack A. Mar 10 '16 at 00:33
  • Interesting. but has all sort of odd implementations. In safari for example, if i move the hidden inputs as part of the target url, so as to not send those fields on both forms actions, when i submit it, it strips all the query values and add only the ones present in the form's inputs. – gcb Mar 10 '16 at 23:20