The Select Tag can be used to add a drop-down menu to your contact form. It can be either optional (select) or required (select*). The user must select at least one option from the menu.
- id:id – adds the id attribute to the tag
- class:class – adds a class attribute to the tag
- default:integer – sets the default selection for the tag. The options in the select are 1-based, so “1” would be the first option, “2” would be the second, etc. Multiple default selections can be set for Select Tags that have the “multiple” option set (see below) by separating the option numbers by the underscore. For example, “default:2_4_6” would pre-select the second, fourth, and sixth options.
- multiple – allows multiple options to be selected on the drop-down
- include_blank – inserts a blank option as the first menu item
- first_as_label – uses the first value entered as a label for the Select Tag
The Select Tag has one or more values, which are used as the options in the drop-down menu.
The Select Tag can also display one value, and submit a second when the form is sent. This is accomplished by creating pipe-separated text/value pairs. For example, the following tag displays the text orange, apple, pear, but submits the corresponding numerical values:
[select choose-fruit "orange|1" "apple|2" "pear|3"]
If the user selects “apple” from the drop-down menu, the value “2” will be included in the email when the Mail Tag “[choose-fruit]” is used on the Mail Tab.
Selectable Values with Pipes
The Select Tag supports text/value pairs so that you can display text that differs from the value you pass in the corresponding Mail Tag.
For example, you could create a Select Tag to allow users to select the recipient of contact form:
[select* the-recipient "Bob Smithemail@example.com" "Ralph Burkefirstname.lastname@example.org" "Patty Reynoldsemail@example.com"]
The employees’ names appear as the text for the options the Select Tag creates, and the email address is passed as the value.
See Set Default Values: Default Values From Context for some interesting possibilities.