Miscellaneous
selectTag()
Signature
Section titled “Signature”selectTag() — returns any
Description
Section titled “Description”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.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | yes | — | See documentation for textFieldTag. |
options | any | yes | — | See documentation for select. |
selected | string | yes | — | Value of option that should be selected by default. |
includeBlank | any | yes | false | See documentation for select. |
multiple | boolean | yes | false | Whether to allow multiple selection of options in the select form control. |
valueField | string | yes | — | See documentation for select. |
textField | string | yes | — | See documentation for select. |
label | string | yes | — | See documentation for textField. |
labelPlacement | string | yes | around | See documentation for textField. |
prepend | string | yes | — | See documentation for textField. |
append | string | yes | — | See documentation for textField. |
prependToLabel | string | yes | — | See documentation for textField. |
appendToLabel | string | yes | — | See documentation for textField. |
Examples
Section titled “Examples”<!--- 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>