| forms - radio button |
|
text textarea buttons image form e-mail form checkbox < radio > select password hidden layout cgi tags epilogue |
Sometimes you will want to choose only one option out of a list.
Like the list on the checkbox page,
with the question "What is your favorite color?". Clearly you
will have only one favorite color, unless you can never make up your mind
about anything.
<INPUT TYPE="radio" NAME="color" VALUE="red">
To this purpose you will use a set of radio buttons. This name refers to radio with different presets, each setting a different channel. You can only listen to one channel at a time. Pushing one button will switch any other one off. All buttons in a set must have the same name. The values will probably differ, although that is not obligatory.
<INPUT TYPE="radio" NAME="color" VALUE="blue" CHECKED>
If you have an idea what the most obvious answer is, you can set that as the default. Most people have blue as a favorite color. So I already set that on with the CHECKED attribute. If you use this attribute more than once, only the last one will be active. If you change the value, and then press the reset button, the default (checked) value will be selected again. |