cfselect and query values

Similar to binding to a cfc but binding with a query on the same page. Notice the query and value attributes and how they relate to the query. I added an ” All” as a default.

<cfquery name="get_last_names" datasource="mydsn">
select distinct last_name from mytable
UNION ALL
select ' All' as last_name
</cfquery>
 
<cfform>
<cfselect name="last_name"
query="get_last_names"
value="last_name"
/>
...

Cup size   
Select size then click on coffee cup.
This entry was posted in Code, Coldfusion, Snippets. Bookmark the permalink.