Hi, Rey... I've been watching this conversation carefully because I want to begin using autocomplete in my apps.
Questions about your solution below: If I'm understanding the code correctly, this is a lookup by sku or product title, right? And products with matching sku's would return the product name and the sku to formfield where the autocomplete was being used? Was the formfield being typed in a text input field? Also, I'm still on CF 4.5 and I know I've got the cfheader and cfcontent tags available to me, but I don't have cfsavecontent... is there a work-around for the lack of that tag? Can I code it without cfsavecontent? And what roll does cfsavecontent play in the solution with jQuery? Last question... (sorry so many!)... is the code, "<cfoutput>#trim( prods )#</cfoutput>" what is being output back to the calling page for display? Would it be possible for you to put a simple demo online using your code so I can see how it's operating? Thanks for all your help in understanding this! It's definitely new ground working with jQuery and AJAX. btw... I did get an email from Tim Buntel over at Adobe. I responded to his email and I'm waiting to hear back from him. Thanks! :o) Rick -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rey Bango Sent: Monday, February 26, 2007 9:57 AM To: jQuery Discussion. Subject: Re: [jQuery] jQuery + ColdFusion - auto complete examples? And in case you wanted some code, here's the way that I used it: ---- Main page that uses autocomplete: <script src="/lib/jquery.js" type="text/javascript"></script> <script src="/lib/autocomplete.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $("#sku").autocomplete("searchskus.cfm", { minChars:3, matchSubset:1, matchContains:1, cacheLength:10, selectOnly:1, lineSeparator:"~", cellSeparator:"|", onItemSelect:selectItem }); }); function selectItem(li) { var v = li.extra[0]; $( "#sku" ).val( v ); } </script> ---- CFM Called by AutoComplete Ajax method: <cfsetting showdebugoutput="no" enablecfoutputonly="no"> <cfquery datasource="#request.ds#" name="product"> select title, sku from products where (title like '%#url.q#%' or sku like '%#url.q#%') and parentSKU = '' order by title </cfquery> <cfcontent type="text/html" reset="Yes" /> <cfheader name="Content-Type" value="text/html; charset=UTF-8"> <cfsavecontent variable="prods"> <cfoutput query="product">#trim(product.title)#|#trim(product.sku)#~</cfoutput> </cfsavecontent> <cfoutput>#trim( prods )#</cfoutput> Priest, James (NIH/NIEHS) [C] wrote: > I'm working on an administration tool and I'd like to use jQuery to > populate a user field - IE the user would type in a few letters of the > last name and have it find the matching names... > > I know there are lots of ColdFusion folks on the list - I'm looking for > some examples :) > > I've used jQuery quite a bit in the rest of this application but it's > all been for display/UI - no Ajax - so now I want to give that a try. > > Thanks! > Jim > > _______________________________________________ > jQuery mailing list > [email protected] > http://jquery.com/discuss/ > -- BrightLight Development, LLC. 954-775-1111 (o) 954-600-2726 (c) [EMAIL PROTECTED] http://www.iambright.com _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/ _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
