I finally am beginning to understand some of this. It took a little
bit for the fact that variable "q" was being passed and not the id of
the input element. And it's right there in the documentation.  I've
tested my query and it give the results I want. But the results passed
to the autocomplete are strange. If I type "charles w" I get "Charles
Wade" but there are 7 more matches in the backend query. And,
following the one item returned, I get code like;
.debug
{
color:black;
background-color:white;

Am I not delimiting the list properly?




<link rel="stylesheet" type="text/css" href="/js/jquery/
jquery.autocomplete.css" />
<script type="text/javascript" src="/js/jquery/jquery-1.2.6.js"></
script>
<script type="text/javascript" src="/js/jquery/
jquery.autocomplete.js"></script>

<script type="text/javascript">
 $(document).ready(function(){
        $("#NewCandidate").autocomplete("panels/panelCandidates_1_db.cfm", {
                width: 460,
                selectFirst: false,
                cacheLength:1,
                mustMatch:true
        });

 });
</script>

<cfinput name="NewCandidate" type="text" autocomplete="off" size="80" /
>

<cfif #find(q,",")#>
<cfset Fname = "#listfirst(q,",")#">
<cfset Lname = "#Listlast(q,",")#">
<cfelse>
<cfset Fname = "#q#">
<cfset Lname = "">
</cfif>

<cfif #find(q,",")#>
<cfset Fname = "#listfirst(q,",")#">
<cfset Lname = "#Listlast(q,",")#">
<cfelse>
<cfset Fname = "#q#">
<cfset Lname = "">
</cfif>

<cfquery name="QsrchIndivs" datasource="#request.dsn#" maxrows="10">
        SELECT ui.firstname + ' ' + ui.lastname + ' -----' + c.name + ' ' +
c.city + '------    ^' + cast(ui.id as varchar) as
Iname,ui.firstname,ui.lastname,ui.current_company_number,c.name,c.city,ui.id
                FROM users_info as ui
                                  left join companies as c on
                                  c.id = ui.current_company_number
                                  WHERE upper(ui.firstname) like 
'#ucase(Fname)#%' <cfif #Lname#
gt " ">And upper(ui.lastname) like '#ucase(Lname)#%' </cfif>
</cfquery>

<cfoutput query="QsrchIndivs">
        #QsrchIndivs.Iname#
</cfoutput>

Reply via email to