Radios
Posted by admin | Posted in HTML Tutorial | Posted on 11-08-2010-05-2008
0
Radios are best used in “multiple choice” type quizzes and questionaires, where the user can have only one single choice.
Radios are types of input forms that allow a user to pick an either/or type of selection. In order to achieve this, we must properly name each radio button selection accordingly. These types of forms must be named.
· value – specifies what will be sent if the user chooses this radio button. Only one value will be sent for a given group of radio buttons (see name for more information).
· name – defines which set of radio buttons that it is a part of. Below we have 2 groups: shade and size.
Example:
- Italian: <input type=”radio” name=”food” />
- Greek: <input type=”radio” name=”food” />
- Chinese: <input type=”radio” name=”food” />
By naming these three radios “food” they are identified as being related by the browser and we achieve this either or effect (only being able to make one selection).
Radio Checked
By using the checked attribute, we can tell our form to automatically “check” a default radio.
Example:
- Italian: <input type=”radio” name=”food” checked=”yes” />
- Greek: <input type=”radio” name=”food” />
- Chinese: <input type=”radio” name=”food” />
