HTML and CSS Reference
In-Depth Information
tial problems, the forms-processing application on the server should be
robust enough to handle missing files, erroneous files, extremely large
files, and files with unusual or unexpected formats.
9.5.2. Checkboxes
The checkbox form control gives users a way to select or deselect an
item quickly and easily in your form. Checkboxes also may be grouped
to create a set of choices, any and all of which the user may select or
deselect.
Create individual checkboxes by setting the
type
attribute for each
<in-
put>
tag to
checkbox
. Include the required
name
and
value
attributes. Only
the values of those items selected by the user appear in the submitted
form. The optional
checked
attribute (no value) tells the browser to dis-
play a selected (checked) checkbox and include its value when submit-
ting the form to the server unless the user deliberately deselects (un-
checks) the box.
The value of the checked checkbox submitted to the server is the
text string you specify in the required
value
attribute. For example, in
XHTML:
<form>
What pets do you own?
<p>
<input type="checkbox" name="pets" value="dog" /> Dog
<br />
<input type="checkbox" checked="checked" name="pets" value="cat" /> Cat
<br />
<input type="checkbox" name="pets" value="bird" /> Bird
<br />
<input type="checkbox" name="pets" value="fish" /> Fish
</p>
</form>