17 Forms

Contents

  1. Introduction to forms
  2. Controls
    1. Control types
  3. The FORM element
  4. The INPUT element
    1. Control types created with INPUT
    2. Examples of forms containing INPUT controls
  5. The BUTTON element
  6. The SELECT, OPTGROUP, and OPTION elements
    1. Pre-selected options
  7. The TEXTAREA element
  8. The ISINDEX element
  9. Labels
    1. The LABEL element
  10. Adding structure to forms: the FIELDSET and LEGEND elements
  11. Giving focus to an element
    1. Tabbing navigation
    2. Access keys
  12. Disabled and read-only controls
    1. Disabled controls
    2. Read-only controls
  13. Form submission
    1. Form submission method
    2. Successful controls
    3. Processing form data
    4. Form content types

17.1 Introduction to forms

An HTML form is a section of a document containing normal content, markup, special elements called controls (checkboxes, radio buttons, menus, etc.), and labels on those controls. Users generally "complete" a form by modifying its controls (entering text, selecting menu items, etc.), before submitting the form to an agent for processing (e.g., to a Web server, to a mail server, etc.)

Here's a simple form that includes labels, radio buttons, and push buttons (reset the form or submit it):

	 <FORM action="http://somesite.com/prog/adduser" method="post">
	    <P>
	    <LABEL for="firstname">First name: </LABEL>
	              <INPUT type="text" id="firstname"><BR>
	    <LABEL for="lastname">Last name: </LABEL>
	              <INPUT type="text" id="lastname"><BR>
	    <LABEL for="email">email: </LABEL>
	              <INPUT type="text" id="email"><BR>
	    <INPUT type="radio" name="sex" value="Male"> Male<BR>
	    <INPUT type="radio" name="sex" value="Female"> Female<BR>
	    <INPUT type="submit" value="Send"> <INPUT type="reset">
	    </P>
	 </FORM>
	

Note. This specification includes more detailed information about forms in the subsections on form display issues.