(Site Identification)

'Eye' Focus: Web Support Tutorials

Forms: The CHECKBOX


Check boxes allow the user to select one or more items with the click of a mouse. If more than one option is possible then a CHECKBOX must be used. On the other hand where only one option is possible a RADIO button is used.

(to Top) Example Form:

For your cup of coffee,
would you like me to:


Syntax: (skip code)

<label for="add1"><input type="checkbox" id="add1" name="add" value="creamer">Include Creamer?</label><br>
<label for="add2"><input type="checkbox" id="add2" name="add" value="sugar">Include Sugar?</label>

(to Top) Definitions


TYPE:

The input TYPE of CHECKBOX is used when more than one choice is possible for a group.

ID:

The ID provides for the LABEL association, making the CHECKBOX and related text properly associated with one another. The labeled text should now properly allow the checkbox to be selected, without having to select the box itself. (Note: Observe the numbering used with like names. Labels and ID's must be uniquely identified on a page.)

NAME:

NAME specifies the name of the variable where the returned value will be stored.

VALUE:

VALUE can be anything you choose. If VALUE is not specified the will generally default to a value related to it's occurance within the form. The first occurrance may be assigned the value 1, second the value 2, etc.


[Updated: Sunday, November 18, 2007]