CF autosuggest无法正常工作

时间:2012-07-31 13:43:00

标签: coldfusion autocomplete coldfusion-8

我正在尝试在coldfusion 8中使用cf autosuggest。 我有输入 -

<cfinput name="tad" 
    autosuggest="(cfc.mywriters(getWriters.authors({cfautosuggestvalue})">

我的cfc是

<cffunction name="getWriters" access="public" returntype="any">
    <cfargument name="writers" required="yes"/>
    <cfset myArray = ArrayNew(1)>
    <cftry>
        <cfquery name="getWriters" datasource="mydb">
            SELECT   authors
            FROM     rp_authors
            ORDER BY authors asc
        </cfquery>
        <cfcatch>
            <cfdump var="#cfcatch#">
        </cfcatch>
    </cftry>
    <cfloop name="getWriters">
        <cfset arrayAppend(myArray,authors)>
    </cfloop>
    <cfreturn myArray>
</cffunction>

1 个答案:

答案 0 :(得分:1)

我会用jQuery来做这件事。这是一个很好的例子:

http://jacktraynor.blogspot.com.au/2012/02/jquery-autocomplete-using-coldfusion.html