List boxes are slightly different from other HTML form elements in that they present multiple options. This being the case, the HTML Editor contains a special tool for keeping your list box options organized. Here's how to use it:
- Go to Insert > Form Items > List Box. This opens the Insert List Box window.
- Enter a name for the list box. This will appear in your form results. Names should be lowercase and should not include any special characters, such as spaces, colons, semicolons, etc.
- Enter your list items. To do this, click underneath Item and enter the text you want to appear in the list. Next, under Value, enter the text you want to appear in the results if the corresponding item is selected. It's usually best to make the value similar to its item. For example, if your item was "Vermont," you could make the corresponding item "vt."
- Click Add to add more item-value pairs to your list.
- Select the desired alignment from the provided options.
- Click OK. The code will be inserted on your page.
Let's do a quick example just to make sure you've got it. Create a new list box, and name it "new-england-states". Next, add the following item-value pairs:
Item - Value
Maine - me
Vermont - vt
New Hampshire - nh
Connecticut - ct
Massachusetts - ma
Rhode Island - ri
Next, make sure the Default alignment option is selected, and then click OK. Switch over to the Preview tab to see your list box in action. It should look like this:
Keep in mind that your list box (and any other form elements) will not work unless you have added <form></form> tags and a form processing script. For more information about this process, read this Knowledgebase article: Adding a Form in the HTML Editor.