Summary of HTML Form Tags and Attributes
<FORM NAME=name>
...
form elements
...
</FORM>
Form Example
Text field
<INPUT TYPE=TEXT NAME=name
VALUE="default text" SIZE=n MAXLENGTH=n>
-
NAME = name of this text field element
-
VALUE = default text that initially appears in input box
-
SIZE = width of the input box in number of characters
-
MAXLENGTH = maximum number of characters allowed in the field
-
TYPE=TEXT is optional for text input boxes
-
[Tab] key moves forward through fields
-
[Shift][Tab] moves backwards through fields
Password field
<INPUT TYPE=PASSWORD NAME=name
...>
-
Same as text field, except typed characters displayed as *****
-
Same tag attributes as text field
-
Caution: Does not ensure information security!
Selection list
<SELECT NAME=name
SIZE=n MULTIPLE>
<OPTION>menu
item text
<OPTION>menu
item text
<OPTION>menu
item text
<OPTION>menu
item text
<OPTION VALUE=value
SELECTED>menu item text
...
</SELECT>
-
NAME = name of this selection list element
-
SIZE = number of items displayed in the menu
-
MULTIPLE allows user to select more than one menu item
-
VALUE = alternative value used in place of menu item text
-
SELECTED makes menu option the initially highlighted one
-
[Ctrl][Mouseclick] selects multiple items from menu
-
[Shift][Mouseclick] selects a range of contiguous items from menu
Radio button group
<INPUT TYPE=RADIO NAME=groupname
VALUE=value CHECKED>
-
NAME = common name of all radio buttons in this group
-
VALUE = value associated with radio button when selected
-
CHECKED makes radio button initially selected
Example:
<INPUT TYPE=RADIO NAME="Party" VALUE="DEM">Democrat<BR>
<INPUT TYPE=RADIO NAME="Party" VALUE="GOP">Republican<BR>
<INPUT TYPE=RADIO NAME="Party" VALUE="IND">Independent<BR>
Checkbox
<INPUT TYPE=CHECKBOX NAME=name
VALUE=value CHECKED>
-
NAME = name of this checkbox element
-
VALUE = value associated with checkbox when selected
-
CHECKED makes checkbox initially selected
Text area window
<TEXTAREA ROWS=n
COLS=n NAME=name WRAP=OFF/SOFT/HARD>
default text
</TEXTAREA>
-
NAME = name of this text area element
-
ROWS, COLS = number of rows and columns of text area window
-
OFF turns off text wrapping within text area window
-
SOFT turns on text wrapping; text is sent to the web server
as a single line without carriage returns (unless explicitly typed by user)
-
HARD turns on text wrapping; text is sent to the web server
as multiple lines with carriage returns, exactly as it appears in the text area
Reset button
<INPUT TYPE=RESET NAME=name
VALUE="button label">
-
NAME = name of this button element
-
VALUE = text that appears as the label on the button
-
Clicking button resets all form elements to their default values