Recently, I am working on an HTML parsing engine, which is particularly confusing when processing <FORM> forms. Based on the experience of the past week, I would like to summarize the HTML form submission rules.
<INPUT>
TYPE = BUTTON
Never submit
<INPUT> TYPE = CHECKBOX: Submit only after checking
<INPUT> TYPE = FILE is always submitted, even if it is null
<INPUT> TYPE = HIDDEN submit forever, even if it is null
<INPUT> TYPE = IMAGE is always submitted, even if it is null
<INPUT> TYPE = PASSWORD: always submit, even if it is null
<INPUT> TYPE = RADIO is submitted only after it is selected. If a group of Radio is not selected, It is not submitted.
<INPUT> TYPE = RESET never submit
<INPUT> TYPE = specifies the button to be clicked by SUBMIT. The value of this button is submitted. Other values of the SUBMIT button are not submitted.
If the form submission is triggered by a JavaScript script, no value is submitted.
<INPUT> TYPE = TEXT is always submitted, even if it is null
<BUTTON>
TYPE = BUTTON
Never submit
<BUTTON> TYPE = RESET never submit
<BUTTON> TYPE = BUTTON clicked by SUBMIT to SUBMIT the value of this BUTTON.
If the TYPE is omitted, IE defaults to BUTTON, and Firefox defaults to SUBMIT.
<SELECT>
NONE
Submit permanently, even if it is null.
<TEXTAREA>
NONE is always submitted, even if it is null.