Forms: A Reference
Prepared for the Instructional Media Group Seminar: FORMS
November, 1996
Tag What you enter What you see Comments
FORM <FORM METHOD="POST" ACTION="url_of_action">
. . .</FORM>
nothing Sets boundaries of form
  • The two options for METHOD are GET and POST. GET is used in database queries (or other situation that make no change in the data); POST is used when changes are made (e.g. additions to a database, form data modified for and e-mail message).
  • ACTION refers to the program or script called to act on the data.
PLAIN TEXT <INPUT TYPE="TEXT" NAME="fieldname"> Allows easy input of single word or line of text.
Parameters:
  • VALUE = " ", specifies initial value in field
  • SIZE = " ", size of field displayed (user may enter longer text)
  • MAXLENGTH = " ", limits number of characters user may enter.
PASSWORD TEXT <INPUT TYPE="PASSWORD" NAME="fieldname"> Same as PLAIN TEXT except that the entry is displayed as bullets rather than characters.
HIDDEN TEXT <INPUT TYPE="HIDDEN" VALUE="value"> nothing Transmits information from the form without displaying it on the form. For instance, you might use it to transmit your email address or a fixed description line.
TEXTAREA <TEXTAREA NAME="fieldname" ROWS="3" COLS="20">
Display default text here
</TEXTAREA>
Note that this is a paired tag, unlike the previous text tags.
    The default text is optional. The ROWS and COLS parameters are required. ROWS and COLS specifies the size of the area on the page. Users can enter beyond those limits. Word wrap is not currently available (November 1996)
MENU:
Single line
<SELECT NAME="fieldname">
<OPTION VALUE="dr"> Drink
<OPTION SELECTED> Eat
<OPTION> Be Merry
</SELECT>
Displays only one selection at a time.
  • OPTION tags list the choices
  • VALUE parameter specifies the value to be passed if that option is chosen. If no VALUE is specified, the displayed option (e.g. Be Merry) is passed.
  • SELECTED parameter specifies which choice is initially displayed.
MENU:
Scrolled
<SELECT NAME="fieldname" SIZE="4">
<OPTION SELECTED> Collie
<OPTION> Beagle
<OPTION VALUE="d"> Dalmation
<OPTION> Poodle
<OPTION> Dachshund
<OPTION> Bloodhound
<OPTION> German Shepard
<OPTION> Cocker Spaniel
</SELECT>
Displays the number of selections specified by SIZE parameter.
  • OPTION, VALUE, and SELECTED are the same as in MENU: Single line.
  • MULTIPLE is a parameter which may be displayed in the SELECT tag to indicate that multiple options may be selected.
CHECKBOX <INPUT TYPE="CHECKBOX" NAME="fieldname"> Sign me up! Sign me up! Best for questions with a yes or no reply.
Parameters:
  • VALUE=" ", specifies the value to be sent if box is checked. Default VALUE is on.
  • CHECKED, sets the default as checked.
RADIO BUTTONS
Select one color:
<INPUT TYPE="RADIO" NAME="fieldname1" VALUE="grn">Green

<INPUT TYPE="RADIO" NAME="fieldname1" VALUE="blu" "CHECKED>Blue

<INPUT TYPE="RADIO" NAME="fieldname1" VALUE="cra" >Cranberry

and one fabric:
<INPUT TYPE="RADIO" NAME="fieldname2" VALUE="cot" >Cotton

<INPUT TYPE="RADIO" NAME="fieldname2" VALUE="lin" >Linen

Select one color:
Green
Blue
Cranberry
and one fabric:
Cotton
Linen
Note that the NAME parameter for alternatw choices is identical (e.g. fieldname1 vs. fieldname2).
  • The radio button allows at most one choice, and if the CHECKED parameter is used, it forces exactly one choice.
  • VALUE is required.
SUBMIT
RESET
<INPUT TYPE="RESET" VALUE="Start Over">

<INPUT TYPE="SUBMIT">


(Note, this SUBMIT button is intentionally disabled.)

The RESET button resets all input fields to their defaults.

The SUBMIT button sends all of the data collected on the form to the server. PARAMETERS:

  • VALUE= " ": Set the text displayed on the face of the buttons. Default values are "Reset" and "Submit Query."
  • NAME=" ": If a name is specified on the SUBMIT button, then the contents of the VALUE parameter will be transmitted.
IMAGE as a SUBMIT button Click on the Bullseye:

<INPUT TYPE="IMAGE" NAME="fieldname" SRC="imagefile.gif">

Click on the Bullseye:


(Also intentionally disabled.)

This can be used instead of the SUBMIT button. Along with the other data from the form, it submits the x- and y-coordinates of the psoition where the user clicked.

NAME is optional. If it is used the coordinates are distinguished as name.X and name.y. Otherwise they are distinguished as x and y.

Some browsers do not support this feature.