HTML and CSS Reference
In-Depth Information
Creating a Selection List
The next part of the survey form records how customers place their orders from Red Ball
Pizza. A customer order can be placed in one of four ways: pickup; delivery; dine in; or
in the case of pizzas, uncooked pizzas that customers can take home and bake. Alice
doesn't want customers to enter their order types into an input box because different
customers will enter this information in different ways, and the large variety of spellings
and text will make it difficult to group and analyze the survey results. Instead, she wants
each user to select the order type from a predetermined group of options. This can be
accomplished using a selection list.
A selection list is a list box that presents users with a group of possible field values for
the data field. It's created using the HTML code
<select name=” name ” id=” id ”>
<option value=” value1 ”> text1 </option>
<option value=” value2 ”> text2 </option>
where the name and id attributes provide the name of the data field and identify the
selection list control, respectively; value1 , value2 , etc. are the possible values of the
data field; and text1 , text2 , etc. are the text of the entries in the selection list that users
see on the Web form. Figure 6-25 shows an example of a selection list used to record
each user's political affiliation.
figure 6-25
creating a selection list
field name
option text
field values
HTML code
option text
appear s when
the dow n -arrow
is clicke d
rendered selection list
Notice that the field value does not have to match the option text. In most cases, the
option text will be more expansive and descriptive to make it easier for users, while the
corresponding value will be brief and succinct for use with the server program analyzing
the form data.
Search WWH ::

Custom Search