Quite a number of folks seem to mistakenly believe that a form can have only one "submit button". This document demonstrates that it is possible to have several form submission "controls" on the same form in HTML, and to detect which one was used in a server-side script, without having to rely on any client-side scripting. Browser coverage for multiple input type=submit
is excellent, in accordance with HTML specifications, which have been sufficiently stable since HTML2.0/RFC1866. (What is true is that a form can have only one action
URL, but that's a different issue, that we're not covering here.)
History: this page goes right back to HTML2.0/RFC1866, though it has been updated from time to time since. My apologies for the somewhat erratic notation used for HTML syntax, which should eventually be unified using lower-case lettering in <code>
markup to make it compatible with both HTML4 and XHTML.
In the HTML4 specification, the term form control is now used as the generic term for input
, button
etc., and the present web page has been updated to take account of that terminology. People often refer to input type=submit
as a "submit button", but we do not want to confuse this with input type=button
, nor with the button
element, both of which are in HTML4 (although, as we'll see, the button
element is implemented too erratically to be of much practical use).
There are some other issues relating to FORMs, that I deal with in separate articles: the RADIO button and the SELECT widget; and one on how to fill in default values using SSI.
This discussion is interspersed with some "live" FORM controls, so that you can try them out. When you use one of the various submission controls, the page will be submitted to a test script that does nothing more than displaying the names and values that it found in the submission (decoded from the encoded submission format, and presented in HTML).
This page deliberately limits itself to pure HTML issues: there's no coverage of client-side scripting (Javascript etc.) here.
Please feel free to examine the HTML source of this document: anything that isn't obvious from the source, I've tried to explain in the text.
A frequently asked question is the one already noted above, How can I submit a form by just hitting ENTER?. This includes some issues that are relevant to the use of multiple submit "controls", so I'd urge you to take a look at it before finalising your design.
Jukka Korpela has some discussions on image buttons, one of a collection of detailed articles on HTML forms.
The WDG's Web Authoring FAQ includes a section on forms.
Original materials © Copyright 1994 - 2006 by A.J.Flavell