HTML and CSS Reference
In-Depth Information
<form>
Which type of animal is your favorite pet?
<p>
<input type=radio name=favorite value="dog"> Dog
<input type=radio checked name=favorite value="cat"> Cat
<input type=radio name=favorite value="bird"> Bird
<input type=radio name=favorite value="fish"> Fish
</form>
As in the previous example with checkboxes, we've tipped our hat to-
ward felines, making the Cat radio button the default choice. If the
user selects an alternativeBird, for instancethe browser automatically
deselects Cat and selects Bird. When the user submits the form to the
server, the browser includes only one value with the name "favorite" in
the list of form parameters; favorite=bird , if that was the last choice.
One of the controls in a group of radio buttons always is selected, so it
makes no sense to create a single radio button. Instead, use groups of
two or more options, such as for On/Off and Yes/No types of form con-
trols.
9.5.4. Action Buttons
Although the terminology is potentially confusing, there is another class
of buttons for forms. Unlike the radio buttons and checkboxes described
previously, these special types of form controls act immediately, their
effects cannot be reversed, and they affect the entire contents of the
form, not just the value of a single field. These "action" buttons (for
lack of a better term) include submit, reset, regular, and image buttons.
When the user selects them, both the submit and image buttons cause
the browser to submit all of the form's parameters to the forms-pro-
cessing server. A regular button does not submit the form but can be
used to invoke an applet to manipulate or validate the form. The reset
button acts locally to erase any user input and have the form revert to
its original (default) contents.
 
Search WWH ::




Custom Search