weballey logo
 
left forms - select backnext right
homesearchsite mape-mail
intro
text
textarea
buttons
image
form
e-mail form
checkbox
radio
< select >
password
hidden
layout
cgi
tags
epilogue
      Lists with radio buttons or checkboxes are fine for short lists. You can make big list with either of those. But there are situations where want to show hundreds of options, and select only one. Like a form that lets you choose a state and a country. You have probably seen dozens of those. In such cases a dropdown list may be better. It keeps the form very compact, you can easily see what country or state you selected.

<SELECT NAME="country">
</SELECT>

    Lists like these are created with the SELECT tag. There is an opening and a closing one. You need to specify a name with the NAME attribute.

<SELECT NAME="country">
<OPTION VALUE="">(select country)</OPTION>
<OPTION VALUE="AF">Afghanistan</OPTION>
<OPTION VALUE="AL">Albania</OPTION>
...
</SELECT>

    The options in the list are created with the OPTION tag. The closing tag is optional. The VALUE attribute is also optional, you can leave it out. If you don't use it, the value after the OPTION tag is submitted with the form. If you use the value attribute, only the value is submitted.

<OPTION VALUE="AF" SELECTED>Antarctica</OPTION>

    In a list like the one above, first one is selected by default. The value would be empty here. If you suspect most of your vistors are penguins, they will probably live in Antarctica. You can set that as the default, by moving it to the first place. You can also use the SELECTED attribute to do so. You can leave the first option (select country) out.

bottom  
left Copyright © Gerben Hoekstra - All rights reserved backnext right