A while back I posted examples of using ColdFusion 8 Ajax support to power an auto-suggest control and related <CFSELECT> controls. Both examples required that the back-end CFC methods create arrays (1 dimension for the former, 2 dimensions for the latter). And I pointed out that I hoped we'd be able to tighten that syntax before we ship.
Well, we did. In the final CF8, the CFC method bound to auto-suggest can return a simple list (a string), and the CFC bound to a <CFSELECT> can return a query. This makes the code orders of magnitude simpler. I am not going to update those entries just yet (as these enhancements won't work with the public beta), but ...
The CFC method to power an auto-suggest could be simplified like this:
<!--- Lookup used for auto suggest --->
<cffunction name="lookupArt" access="remote" returntype="string">
<cfargument name="search" type="any" required="false" default="">
<!--- Define variables --->
<cfset var result="">
<!--- Do search --->
<cfquery datasource="#THIS.dsn#" name="result">
SELECT artname
FROM art
WHERE UCase(artname) LIKE Ucase('#ARGUMENTS.search#%')
ORDER BY artname
</cfquery>
<!--- And return it --->
<cfreturn ValueList(result.artname)>
</cffunction>
The CFC method to power a <CFSELECT> could now just return a query. And the <CFSELECT> control would then use the existing VALUE and DISPLAY attributes to specify the query columns to be used, like this:
<cfselect name="mediaid"
bind="cfc:art.getMedia()"
bindonload="true"
value="MediaID"
display="MediaType" />
These are great little enhancements, and I am glad the team was able to get them in just in time.
<cfajaxproxy cfc="[mypath].QuotesGrid" jsclassname="jQuotesGrid" />
how I resolved the "...not caught" issue.
When I moved my CFC file into the server root, the feature worked fine. How can I make it work inside another directory, though?