[html5] button element value on submission

Brian Tremblay webmaster at tsmchughs.com
Fri Jun 24 11:03:24 PDT 2011


Given a form with 2 submit buttons, each with its own value, what 
happens onsubmit? The spec says that only the value of the button used 
to submit the form is to be submitted. What is actual client behavior?

Details: I have pages with 2 forms to allow visitors to purchase a photo 
via PayPal. The forms are identical, each with a single select element 
and several hidden inputs, except for one hidden input's value; one is a 
"buy now" form, the other an "add to card" form.
I was thinking of moving the value of the hidden inputs to buttons, then 
putting both buttons in the same form.

I another page with 2 forms, each with a single input type=text field, 
and there too it might be easier to maintain if I had one form with 
different values for the submit button.

After reading
http://www.alanflavell.org.uk//www/trysub.html
it appears that the submit element is out, thanks to a borked 
implementation in MSIE (as late as v.6!).

I've also read
http://www.alanflavell.org.uk//www/formquestion.html
but it's a bit old now. So perhaps I can still do it using input 
type=submit. Does anyone have any experience here? Are there other 
resources on the web I can check?

-- 
Brian Tremblay



More information about the Help mailing list