[an error occurred while processing this directive]
Checkboxes

Checkboxes are used to allow the user to select an item with the click of a mouse. Groups of checkboxes can be used to create checklists. The inital value of a checkbox can be defined to be checked or not. If you want to set up a checklist from which the user may only select one item, then you should use radio buttons instead of checkboxes.


Example

Which of the following sports do you enjoy watching? (choose any combination)


<UL>
<BR><INPUT TYPE=checkbox NAME="baseball" VALUE="Y">Baseball
<BR><INPUT TYPE=checkbox NAME="basketball" VALUE="Y">Basketball
<BR><INPUT TYPE=checkbox NAME="football" VALUE="Y">Football
<BR><INPUT TYPE=checkbox NAME="hockey" VALUE="Y">Hockey
<BR><INPUT TYPE=checkbox NAME="soccer" VALUE="Y">Soccer
</UL>

TYPE tells the browser to produce a checkbox field, NAME specifies the variable where the returned value will be stored, and VALUE stores what will be returned in the variable when the box is checked. VALUE can be anything you choose. If you don't specifiy a VALUE, the value of checked fields defaults to "on". If a field is not checked, no value is returned to the ACTION program (as though the field did not even exist on the form).



Checkboxes with defaults
Which of the following sports do you enjoy watching? (choose any combination)

The boxes above that are already checked by default have the CHECKED keyword in their form definition as follows:

<BR><INPUT TYPE=checkbox NAME=baseball VALUE="Y" CHECKED>Baseball

Next lesson: Radio Buttons (choosing one of many)

Index of tutorial topics

[an error occurred while processing this directive]