0

我正在尝试在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>
4

1 回答 1

1

我会使用 jQuery 来做到这一点。这是一个很好的例子:

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

于 2012-08-01T03:04:16.310 回答