I'm trying to create a page where the user inputs either a first or last name and it returns suggested matches using the autosuggest tag in CFML.
On the first screen, the user begins typing and then the suggested entries pop-up
When a staff member is selected, I am getting the wrong display for the name - I get the first 2 letters:
Here are my issues and I don't know what to do about them... Any insight you could provide would be greatly appreciated. Feel free to ask any questions you would need for clarification.
1) When a user is selected from the dropdown, I would like the full name of that person to be displayed. (I don't know which variable I would place there - right now I'm using the staffname, which is why I'm only getting whatever I enter in the input.
2) I don't like that little "wheel" that displays to the right of the input box. Is there a way to disable that?
3) I'm currently using "displayname" as the search field in the query. What I need
to use are fields first (for first name) and last (for last name) and search any combinations one might provide.
For example if they typed "tra" the results would be:
I've include jquery and ajax in on this as there's almost always an - if not easier - equal solution to a CFML problem in those languages.
this is my page autosuggest.cfm
<cfparam name="staffname" default="">
<cfform method="post" action="autosuggest.cfm">
Here's my autosuggest.cfc
<!--- Lookup used for auto suggest --->
<cffunction name="lookupStaff" access="remote" returntype="array">
<cfargument name="search" type="any" required="false" default="">
<!--- Define variables --->
<cfset var qry_getStaff="">
<cfset var result=ArrayNew(1)>
<!--- Do search --->
<cfquery datasource="#THIS.dsn#" name="qry_getStaff">
WHERE displayname LIKE '#ARGUMENTS.search#%' and emailstatus = 'active'
ORDER BY displayname
<!--- Build result array --->
<cfset ArrayAppend(result, displayname)>
<!--- And return it --->