cfselect

Constructs a drop-down list box form control. Used within a
cfform tag.

You can populate the list from a query, or by using the HTML
option tag.

  <cfselect name="">

 cfselect(name="");

Discouraged: The use of tags generating UI is generally discouraged by the CFML community. See: http://static.raymondcamden.com/cfuitherightway/cfpod/index.html

cfselect Attribute Reference

name string
Required

Name of the select form element

id string

ID for form input element.

bind string

A bind expression that dynamically sets an attribute
of the control.

bindAttribute string

Specifies the HTML tag attribute whose value is set
by the bind attribute. You can only specify attributes
in the browser‚ HTML DOM tree, not ColdFusion-
specific attributes.
Ignored if there is no bind attribute.

bindOnLoad boolean
Default: false

A Boolean value that specifies whether to execute
the bind attribute expression when first loading the
form. Ignored if there is no bind attribute.
Values:
  • true
  • false

editable boolean
Default: false

Boolean value specifying whether you can edit the
contents of the control.
Values:
  • true
  • false

label string

Label to put next to the control on a Flash or XML-format form.

style string

In HTML or XML format forms, ColdFusion passes the
style attribute to the browser or XML.
In Flash format, must be a style specification in CSS
format, with the same syntax and contents as used in
Macromedia Flex for the corresponding Flash element.
Post alpha we will document specifics.

sourceForTooltip string

The URL of a page to display as a tool tip. The page
can include CFML and HTML markup to control the
tip contents and format, and the tip can include
images.
If you specify this attribute, an animated icon
appears with the text "Loading..." while the tip is
being loaded.

size numeric
Default: 1

Number of entries to display at one time. The default, 1,
displays a drop-down list. Any other value displays a list
box with size number of entries visible at one time.

required boolean
Default: false

If true a list element must be selected when form is submitted.
Note: This attribute has no effect if you omit the size
attribute or set it to 1 because the browser always submits
the displayed item. You can work around this issue format
forms by having an initial option tag with value=" " (note the
space character between the quotation marks).
Default: false
Values:
  • true
  • false

message string

Message to display if required="true" and no selection is made.

onerror string

Custom JavaScript function to execute if validation fails.

multiple boolean
Default: false

- true: allow selecting multiple elements in drop-down list
- false: don't allow selecting multiple elements
Default: false
Values:
  • true
  • false

query string

Name of query to populate drop-down list.

value string

Query column to use for the value of each list element.
Used with query attribute.

display string

Query column to use for the display label of each list
element. Used with query attribute.

group string

Query column to use to group the items in the drop-down
list into a two-level hierarchical list..

queryposition string
Default: above

If you populate the options list with a query and use HTML
option child tags to specify additional entries, determines
the location of the items from the query relative to the items
from the option tags:
- above: Put the query items above the options items.
- below: Put the query items below the options items.
Default: above
Values:
  • above
  • below

selected string

One or more option values to preselect in the selection list.
To specify multiple values, use a comma-delimited list. This
attribute applies only if selection list items are generated
from a query. The cfform preservedata attribute value can
override this value.

onkeyup string

JavaScript (HTML/XML) or ActionScript (Flash) to run
when the user releases a keyboard key in the control.

onkeydown string

JavaScript (HTML/XML) or ActionScript (Flash)
ActionScript to run when the user depresses a keyboard
key in the control.

onmouseup string

JavaScript (HTML/XML) or ActionScript (Flash) to run
when the user presses a mouse button in the control.

onmousedown string

JavaScript (HTML/XML) or ActionScript (Flash) to run
when the user releases a mouse button in the control.

onchange string

JavaScript (HTML/XML) or ActionScript (Flash) to run
when the control changes due to user action.

onclick string

JavaScript to run when the user clicks the control.

enabled boolean
Default: true

Flash only: Boolean value specifying whether to show the control.
Space that would be occupied by an invisible control is
blank.
Default: true
Values:
  • true
  • false

visible boolean
Default: true

Flash only: Boolean value specifying whether to show the control.
Space that would be occupied by an invisible control is
blank.
Default: true
Values:
  • true
  • false

tooltip string

Flash only: Text to display when the mouse pointer hovers over the control.

height numeric

The height of the control, in pixels.

width numeric

The width of the control, in pixels.

passthrough string

This attribute is deprecated.

Passes arbitrary attribute-value pairs to the HTML code
that is generated for the tag. You can use either of the
following formats:

passthrough="title=""myTitle"""
passthrough='title="mytitle"'

onbinderror string

The name of a JavaScript function to execute if evaluating a bind expression results in an error. The function must take two attributes: an HTTP status code and a message.

Fork me on GitHub