For Adobe ColdFusion application servers Select

A select format field creates a select box from a list or query. If you are building the field from a list, you must specify a valuelist, and optonal displaylist (the displayed equivalent of each value) and optional delimiters. If you are building the field from a query, you must specify a valuecolumn, and optonal displaycolumn (the column containing the displayed equivalent of each value).

Specify groupList or groupColumn to employ groups within your select box implemented using the HTML optgroup element. All values with the same group value will be grouped together. For example:

<cf_terrafield
  name="locationId"
  format="select"
  query="locations"
  valueColumn="locationId"
  displayColumn="locationName"
  groupColumn="regionName"
/>

If specified, the prompt and promptvalue attributes will be used to generate the first item in the list. For example, prompt="> Choose <". promptvalue is the value submitted if the prompt is selected when the form is submitted.

Note that if your list data contains commas, you will need to use and specify an alternative delimiter for your list using the delimiters attribute. This is not a concern with query data.

Other non-TerraField attributes will be passed through to the underlying select box tag (<select>). For example:

  • size="10"
  • multiple
  • onChange="submit()"

Examples

A select box field built from a list:

<cf_terrafield
  name="Locale"
  format="select"
  valuelist="#Server.ColdFusion.SupportedLocales#"
  default="#GetLocale()#"
  prompt="Choose your locale"
/>

A select box field built from a query, with grouping:

<cf_terrafield
  name="cityId"
  format="select"
  datatype="Integer"
  query="cities"
  valuecolumn="cityId"
  displaycolumn="cityName"
  groupColumn="stateName"
/>

A select box field built from a query, with multiple selections allowed:

<cf_terrafield
  name="ProductIDs"
  format="select"
  datatype="IntegerList"
  multiple="yes"
  query="Products"
  valuecolumn="ProductID"
  displaycolumn="ProductName"
  size="#Products.RecordCount#"
/>
(Hold down the Ctrl key to select multiple products)

HyperText Markup Language
The coding language used to create hypertext documents for use on the World Wide Web.
No comments yet