Downloaded autocomplete plugin. its not bring out results am using an access db. When I type in text it does the search but with no proposed results display in the drop down.
Is there something missing?

<cfsetting enablecfoutputonly="true">
<cfparam name="q" default="" />
<cfquery name="qryGetCountry" datasource="dbtest">
FROM Cities
WHERE Cities.RegionCity LIKE <cfqueryparam value="#URL.q#*"/>
<cfoutput query="qryGetCountry">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" xml:lang="en" lang="en">
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
	<title>Auto Complete - jQuery</title>
	<script type="text/javascript" src="scripts/jquery-1.2.6.min.js"></script>
	<script type="text/javascript" src="scripts/jquery.autocomplete.js"></script>
	<link type="text/css" href="styles/autocomplete.css" rel="stylesheet" media="screen" />

	<script type="text/javascript">
		$(document).ready(function() {

				["Bath","Birmingham","Bradford","Brighton and Hove","Bristol",
				"Kingston upon Hull","Lancaster","Leeds","Leicester","Lichfield",
				"St Albans","Stoke-on-Trent","Sunderland","Truro","Wakefield","Wells",

<h1>Auto Complete</h1>
<h3>Example 1.: Country Lookup</h3>
<p>Using <abbr title="Asynchronous JavaScript and XML">AJAX</abbr> to interrogate the database.</p>
<p>Example data: Australia, Bulgaria, United Kingdom</p>
<form name="frmAutoCompleteCountry" id="frmAutoCompleteCountry" action="#" method="post">
<label for="country">Country</label>
<input type="text" name="country" id="country" />
<p>NB. If you have <a href="" title="Get Firebug">Firebug</a> installed you will be able to view the <abbr title="Asynchronous JavaScript and XML">AJAX</abbr> call.</p>
<h3>Example 2.: City Lookup</h3>
<p>Using a local array to populate data.</p>
<p>Example data: Bradford, Leeds, Salisbury, York</p>
<form name="frmAutoCompleteCity" id="frmAutoCompleteCity" action="#" method="post">
<label for="city">City</label>
<input type="text" name="city" id="city" />

Recommended Answers

Can't help you with jquery. But why not just use CF's built in autosuggest? Are you running CF8 or higher?

Jump to Post

All 3 Replies

I will try your link thanks :)

I have uploaded the demo but its not functioning, I have an access database with a list of countries. I want it to autocomplete the countries based on the demo I have left the javascript id for the form elements as is. My demo code is as following:

<!--- A simple form for auto suggest --->
<cfform action="autosuggest.cfm" method="post">
	Park Name:<br />
    <cfinput type="text" name="parkname" size="50" autosuggest="cfc:autosuggest.findPark({cfautosuggestvalue})" autosuggestminlength="1" maxresultsdisplayed="10" /><br /><br />

The function as mentioned in the tutorial

<cfcomponent output="false">

	<!--- Lookup used for auto suggest --->
	<cffunction name="findPark" access="remote" returntype="string">
		<cfargument name="search" type="any" required="false" default="">
		<!--- Define variables --->
		<cfset var local = {} />
		<!--- Query Location Table --->
		<cfquery name="local.query" datasource="dbtest" >
			select		Country
			from		Cities
			where		Country like <cfqueryparam cfsqltype="cf_sql_varchar" value="#ucase(" />
			order by	Country

		<!--- And return it as a List --->
		<cfreturn valueList(local.query.Country)>


In for instance you change the statement and it should work. Please help :) is there anything I left out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.