> why dont you try the same ajax method that is used with the city 
> local
> 
> #1. create a page like names.cfm
> add the below code
> <cfsilent>
>       <cfset debug = false />
>       <cfparam name="url.q" type="string" />  
>       <cfquery name="getMatches" datasource="cfdocexamples">
>               select firstname,LASTNAME from employee where lower(firstname) 
> like 
> '#lCase(url.q)#%'
>       </cfquery>
> </cfsilent><cfoutput query="getMatches">#getMatches.
> firstname##getMatches.LASTNAME#
> </cfoutput>
> 
> #2 apply the input to autocomplete and specify the ajax page. see 
> complete code below
> 
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> <html xmlns="http://www.w3.org/1999/xhtml";>
> <head>
> <meta http-equiv="Content-Type" content="text/html; 
> charset=iso-8859-1" />
> <title>Untitled Document</title>
> <script src=".jquery-1.3.2.min.js" type="text/javascript"></script>
> <script src="jquery.autocomplete.js" type="text/javascript"></script> 
> 
> <link rel="stylesheet" href="jquery.autocomplete.css"/>
> <script>
> function findValue(li) {
>       if( li == null ) return alert("No match!");
>       // if coming from an AJAX call, let's use the CityId as the value
>       if( !!li.extra ) var sValue = li.extra[0];
>       // otherwise, let's just display the value in the text box
>       else var sValue = li.selectValue; 
>       //alert("The value you selected was: " + sValue);
> }
 
> 
> function selectItem(li) {
>       findValue(li);
> }
> function formatItem(row) {
>       return row[0] + " (id: " + row[1] + ")";
> }
 
> 
> function lookupAjax(){
>       var oSuggest = $("#suggest")[0].autocompleter;
 
> 
>       oSuggest.findValue();
 
> 
>       return false;
> }
 
> 
> function lookupLocal(){
>       var oSuggest = $("#suggest")[0].autocompleter;
 
> 
>       oSuggest.findValue();
 
> 
>       return false;
> }
 
> 
>       $(document).ready(function(){
>                       $("#suggest").autocomplete(
>                               "names.cfm",
>                               {
>                                       delay:10,
>                                       minChars:2,
>                                       matchSubset:1,
>                                       matchContains:1,
>                                       cacheLength:10,
>                                       onItemSelect:selectItem,
>                                       onFindValue:findValue,
>                                       formatItem:formatItem,
>                                       autoFill:true
>                               }
>                       );
>       })
> </script>
> </head>
> <body>
> <label>Auto suggest Sample</label>
> <input name="suggest" id="suggest"  />
> </body>
> </html>
> 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322913
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to