I'm not sure if the mailing list cut off some code, but your SELECT
statement is missing your variable after the LIKE keyword.

mike 

-----Original Message-----
From: Ian Vaughan [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 12, 2008 9:34 AM
To: CF-Talk
Subject: CF, Ajax and Autocomplete Problems

Hi 

I have been trying to get script.aculo.us autocomplete code to work with
Coldfusion, with no avail, and would appreciate any advice / guidance on
what I am doing wrong please.

When typing in the search box no suggestions appear?  Its based on code
from http://www.petefreitag.com/item/605.cfm 

Here is my code
----
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>


<script src="/js/prototype.js" type="text/javascript"></script> <script
src="/js/scriptaculous.js" type="text/javascript"></script>

<style>
...selected { background-color: #f1f1f1; } #suggestionBox { display:none;
border: 1px solid silver; } </style> </head>

<body>

<form action="search.cfm">
  <input type="text" name="surname" id="surname" autocomplete="off" />

</form>
    <div id="ac" style="display:none;border:1px solid
black;background-color:white;"></div>
        
<script type="text/javascript" language="javascript" charset="utf-8">
                // <![CDATA[
                var a_c = new
Ajax.Autocompleter('surname','ac','suggest.cfm', {});
                // ]]>
                </script>
</body>
</html>

and the suggest.cfm page is below

<cfsilent>
<cfparam name="form.surname" default="" type="string"> <cfquery
datasource="dsnhere" name="suggestions">
  SELECT surname
  FROM contacts
  WHERE surname LIKE
  ORDER by surname ASC
  LIMIT 10
</cfquery>
<ol>
<cfoutput query="suggestions">
  <li>#suggestions.surname#</li>
</cfoutput>
</ol>
</cfsilent>

Kind Regards,

Ian

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312439
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to