Builds and returns a string containing a select form control based on the supplied name and options. Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name | Type | Required | Default | Description |
---|---|---|---|---|
name | string | Yes | See documentation for textFieldTag. | |
options | any | Yes | See documentation for select. | |
selected | string | No | Value of option that should be selected by default. | |
includeBlank | any | No | false | See documentation for select. |
multiple | boolean | No | false | Whether to allow multiple selection of options in the select form control. |
valueField | string | No | See documentation for select. | |
textField | string | No | See documentation for select. | |
label | string | No | See documentation for textField. | |
labelPlacement | string | No | around | See documentation for textField. |
prepend | string | No | See documentation for textField. | |
append | string | No | See documentation for textField. | |
prependToLabel | string | No | See documentation for textField. | |
appendToLabel | string | No | See documentation for textField. |
<!--- Controller code ---> <cfset cities = model("city").findAll()> <!--- View code ---> <cfoutput> #selectTag(name="cityId", options=cities)# </cfoutput> <!--- Do this when CFWheels isn''t grabbing the correct values for the `option`s'' values and display texts ---> <cfoutput> #selectTag(name="cityId", options=cities, valueField="id", textField="name")# </cfoutput>