Select boxes are HTML controls of the form of


Binding to a Process Variable

A select box can be bound to a process variable using the cam-variable-name directive:

<select cam-variable-name="foo"

Supported Variable Types

The select box supports the same value types as <input type="text">.

Populating the Options from a Variable

The <option> entries can be populated using a variable. The name of the variable can be provided using the cam-choices directive:

<select cam-variable-name="PRODUCT_TYPE"

The directive cam-choices expects the values to be a List or Map (Object). In case of a Map (Object), the keys of the map are used as values of the options. java.util.Map and java.util.List are supported but must be serialized as JSON:

Map<String, String> productTypes = new HashMap<String, String>();
productTypes.put("001", "Notebook");
productTypes.put("002", "Server");
productTypes.put("003", "Workstation");

execution.setVariable("AVAILABLE_PRODUCT_TYPES",  Spin.JSON(productTypes));

Would be rendered as

<select cam-variable-name="PRODUCT_TYPE"
  <option value="001">Notebook</option>
  <option value="002">Server</option>
  <option value="003">Workstation</option>

On this Page: