HTML 4.01 introduced the concept of successful form controls. Quoting the HTML 4.01 specifications, "
A successful control is "valid" for submission. Every successful control has its control name paired with its current value as part of the submitted form data set. A successful control must be defined within a . This definition might lead to some confusion, so the specifications add the following:
form element and must have a control name.
- Controls that are disabled cannot be successful.
- If a form contains more than one submit button, only the activated submit button is successful.
- All "on" checkboxes may be successful.
- For radio buttons that share the same value of the
nameattribute, only the "on" radio button may be successful.
- For menus, the control name is provided by a
selectelement and values are provided by
optionelements. Only selected options may be successful. When no options are selected, the control is not successful and neither the name nor any values are submitted to the server when the form is submitted.
- The current value of a file select is a list of one or more file names. Upon submission of the form, the contents of each file are submitted with the rest of the form data. The file contents are packaged according to the form's content type.
- The current value of an object control is determined by the object's implementation.
If a control doesn't have a current value when the form is submitted, user agents are not required to treat it as a successful control.
Furthermore, user agents should not consider the following controls successful:
- Reset buttons.
declareattribute has been set.
Hidden controls and controls that are not rendered because of style sheet settings may still be successful.
From a client-side perspective, only successful form controls should be taken into account. For example, the
serialize() method of jQuery serializes only successful form controls. However, browsers tend to treat form controls in a very loose way, in the sense that they allow also for submission of unsuccessful form controls. In fact, it's not uncommon to see reset and submit buttons to be processed on the server-side of a web application. In practice, the limitations introduced several years ago by HTML 4.01 are not respected in most cases.
A typical example are
select controls. Even though you don't make a choice between values, that is, if you don't pick up an item from these controls, browsers will always submit your control with a default value which, in most cases, is the first
option in the list or an empty value.
Generally, browsers tend to submit all controls that have a
name attribute set, though HTML specifications don't explicitly allow for this behavior.