Drop-down lists that allow a user to select one value out of several options are an important part of web interfaces. In Tapestry, we use a Select
component to display such a drop-down list. Every time we have a fixed set of several options in our code, we need to think of enumeration, and it is natural that the easiest way to use the Select
component is in combination with an enumeration.
Let's suppose that in the process of registration, we want to ask our users which country they are from. This is how the control we are going to add to the Registration page should look:
In page template, this addition will look like this:
<tr> <td>Country:</td> <td> <select t:type="select" t:model="countries" t:value="country"> <option>Country 1</option> <option>Country 2</option> </select> </td> </tr>
You can see a Tapestry's Select
component hidden inside of a mocked-up HTML<select>
control. If you prefer, you...