cfautosuggest is cool
I was crazy over GMail when I saw auto suggest function. That’s why I’ve used that features most of my projects, referring from http://script.aculo.us. If I use javascript coding from it, we need to do some changes for our projects.If you’re not well-expert in javascript, you can’t do anything for it. Upset..?? Don’t worry. You can use cfautosuggest. Volià..!!
<cfform action=”autosuggest.cfm” method=”post”>
Name:<br />
<cfinput type=”text” name=”contactname” size=”50″ autosuggest=”cfc:autosuggest.findContact({cfautosuggestvalue})” autosuggestminlength=”1″ maxresultsdisplayed=”10″ /><br /><br />
</cfform>
autosuggest.cfc
<cfcomponent output=”false”>
<!— Lookup used for auto suggest —>
<cffunction name=”findContact” access=”remote” returntype=”string”>
<cfargument name=”search” type=”any” required=”false” default=”"><!— Define variables —>
<cfset var local = {} /><!— Query Location Table —>
<cfquery name=”QryAutoSuggestSimple” datasource=”cfexample” >
select contactname
from contacts
where contactname like <cfqueryparam cfsqltype=”cf_sql_varchar” value=”#ucase(arguments.search)#%” />
order by contactname
</cfquery><!— And return it as a List —>
<cfreturn valueList(QryAutoSuggestSimple.contactname)>
</cffunction></cfcomponent>

