tags:

views:

41

answers:

1

If you have a cfselect command that builds its options list from a getter function, how do you write it?

cfselect name="FooID" query="scope.functionname.getFoo()" Display="FooName" value="FooID" />

Or maybe, as someone said in a previous post, I should build the options list in a cfsavecontent and therefore it will be cached.

+2  A: 
<cfset myQuery = scope.functionname.getFoo()>
<cfselect name="FooID" query="myQuery" Display="FooName" value="FooID" />

Query attribute = Name of query to populate drop-down list.

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7afe.html

And yes, if the query doesn't change, and HTML is the only output you need, it's a good idea to cache the generated HTML.

Henry