HTML and CSS Reference
To select an option by default, include the selected attribute in an option element, as
<option value=“p101”> Programming 101 </option>
<option value=“e312”> Ecomomics 312 </option>
<option value=“pe221” selected=“selected”> Physical Education 221 </option>
<option value=“bw499”> Basket Weaving 499 </option>
Thus far, you've created menus from which a user can select only one choice. To enable
users to select more than one option, use the multiple attribute:
<select name=“courses” multiple=“multiple”>
A user can choose multiple options by Shift-clicking for Windows, or
Ctrl-clicking or Command-clicking for Macintosh.
There are some usability issues associated with select lists. When you think about it, select
lists that enable users to choose one option are basically the equivalent of radio button
groups, and select lists that allow multiple selections are the same as check box groups. It's
up to you to decide which tag to use in a given circumstance. If you need to present the
user with a lot of options, select lists are generally the proper choice. A select list with a
list of states is a lot more concise and usable than a group of 50 radio buttons. By the same
token, if there are four options, radio buttons probably make more sense. The same rules
basically hold with check box groups versus multiple select lists.
The other usability issue with select lists is specific to multiple select lists. The bottom line
is that they're hard to use. Most users don't know how to select more than one item, and if
the list is long enough, as they move through the list they'll have problems keeping track of
the items they already selected when they scroll through to select new ones. Sometimes
there's no way around using a multiple select list, but you should be careful about it.
Task: Exercise 11.2: Using Several Types of Form Controls
Form controls often come in bunches. Although there are plenty of forms out there that
consist of a text input field and a Submit button (like search forms), a lot of the time
forms consist of many fields. For example, many websites require that you register to see
restricted content, download demo programs, or participate in an online community. In this
example, we'll look at a perhaps slightly atypical registration form for a website.