Re: [jQuery] jQuery + ColdFusion - auto complete examples?
Here's a quick example: http://www.co-opcookbook.com/test.cfm It's not working 100% right now, I think due to the way mySQL stores the data (extra carriage returns at the end maybe). But here's the code for it (note, this uses an older version of jQuery). I haven't take the time to update this example page. Here's TEST.cfm html head title the recipe MANAGER/title script language=javascript src=includes/jquery.js type=text/javascript/script script language=javascript src=includes/autocomplete.js type=text/javascript/script link href=includes/styles.css rel=stylesheet type=text/css / style type=text/css !-- /* set the page background color and margins. */ body { margin: 20px; } -- /style script type=text/javascript function selectItem(li) { if (li.extra) { $('#fk_ing_id').val(li.extra); } } function formatItem(row) { return row[0]; } $(document).ready(function() { var curID = 0; $(#ingredient).autocomplete(search.cfm, { minChars:1, matchSubset:1, matchContains:1, cacheLength:10, onItemSelect:selectItem, formatItem:formatItem, selectOnly:1 }); $('#saveandadd').click( function() { curID++; // get value from quanty drop downs var whole = $('#wQty').val(); var fraction = $('#fQty').val(); var qty = parseInt(whole) + (fraction*1); var unitID = $('#unit').val(); var unitText = $('#unit option:selected').text(); alert(unitText); var ing = $('#ingredient').val(); // duplicate the template row $('#template').clone().id(curID).appendTo('#ingHeader').removeClass('hideMe' ); // set the values $('#' + curID).html(qty + ' ' + unitText + ' ' + ing) }) }); /script /head body brbr cfquery name=getUnit dataSource=#Application.DSN# username=#APPLICATION.user# password=#Application.pass# SELECT * FROM r_unit ORDER BY recunit_name /cfquery cfquery name=getFraction dataSource=#Application.DSN# username=#APPLICATION.user# password=#Application.pass# SELECT * FROM r_fractions WHERE numerator != 0 ORDER BY value /cfquery cfoutput fieldset id=entry legendIngredient Entry/legend select id=wQty class=addIng option value=0--/option cfloop index=q from=1 to=50 option value=#q##q#/option /cfloop /selectnbsp;nbsp; (and select id=fQty class=addIng option value=0--/option cfloop query=getFraction option value=#value##numerator#/#denominator#/option /cfloop /select )nbsp;nbsp; select id=unit class=addIng cfloop query=getUnit option value=#recunit_id##recunit_name#/option /cfloop /selectnbsp;nbsp; input type=text id=ingredient class=addIng input type=hidden id=fk_ing_id value= nbsp;nbsp; input type=button id=saveandadd value=Save Add Another /fieldset /cfoutput div id=ingHeaderbIngredient Data/b/div div id=template class=hideMe ingData/div /body /html And here's search.cfm cfquery name=get dataSource=#Application.DSN# username=#APPLICATION.user# password=#Application.pass# SELECT * FROM r_ingredients WHERE rec_list_ingredient LIKE cfqueryparam value=%#Trim(URL.q)#% cfsqltype=CF_SQL_VARCHAR /cfquery cfoutput query=get#rec_list_ingredient#|#rec_list_id# /cfoutput -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Priest, James (NIH/NIEHS) [C] Sent: Monday, February 26, 2007 8:32 AM To: jQuery Discussion. Subject: [jQuery] jQuery + ColdFusion - auto complete examples? 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 discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery + ColdFusion - auto complete examples?
Wow. This is very nice. And fast. Thank you! Rey Bango wrote: James!!! Welcome bud. I see you posting on my blog all of the time. Glad to see you came on over to jQuery. For autocomplete functionality, I've sued this one successfully: http://www.dyve.net/jquery/?autocomplete Also, look at the plugins page (http://docs.jquery.com/Plugins) and you'll find some more options for this. Rey 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 discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] jQuery + ColdFusion - auto complete examples?
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 discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery + ColdFusion - auto complete examples?
There is a complete CF-based example here: http://www.pengoworks.com/workshop/jquery/autocomplete.htm He includes the CFM as a txt file at the bottom of the page... I just implemented it and it's pretty simple to do following his lead. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Priest, James (NIH/NIEHS) [C] Sent: Monday, February 26, 2007 7:32 AM To: jQuery Discussion. Subject: [jQuery] jQuery + ColdFusion - auto complete examples? 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 discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery + ColdFusion - auto complete examples?
Paul Rey, Thanks for the links Looks like a good starting point!! I'm sure I'll have questions :) I'm really enjoying jQuery - used it quite a bit in my current application - everyone I've shown it too has been impressed! I've been impressed with how easy it's been to implement everything! Hope the Ajax stuff is as easy :) Jim -Original Message- From: Paul [mailto:[EMAIL PROTECTED] Sent: Monday, February 26, 2007 11:20 AM To: 'jQuery Discussion.' Subject: Re: [jQuery] jQuery + ColdFusion - auto complete examples? There is a complete CF-based example here: http://www.pengoworks.com/workshop/jquery/autocomplete.htm He includes the CFM as a txt file at the bottom of the page... I just implemented it and it's pretty simple to do following his lead. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery + ColdFusion - auto complete examples?
No sweat bud. Let me know if you need anymore help. :o) Rey Priest, James (NIH/NIEHS) [C] wrote: Paul Rey, Thanks for the links Looks like a good starting point!! I'm sure I'll have questions :) I'm really enjoying jQuery - used it quite a bit in my current application - everyone I've shown it too has been impressed! I've been impressed with how easy it's been to implement everything! Hope the Ajax stuff is as easy :) Jim -Original Message- From: Paul [mailto:[EMAIL PROTECTED] Sent: Monday, February 26, 2007 11:20 AM To: 'jQuery Discussion.' Subject: Re: [jQuery] jQuery + ColdFusion - auto complete examples? There is a complete CF-based example here: http://www.pengoworks.com/workshop/jquery/autocomplete.htm He includes the CFM as a txt file at the bottom of the page... I just implemented it and it's pretty simple to do following his lead. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- BrightLight Development, LLC. 954-775- (o) 954-600-2726 (c) [EMAIL PROTECTED] http://www.iambright.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery + ColdFusion - auto complete examples?
James!!! Welcome bud. I see you posting on my blog all of the time. Glad to see you came on over to jQuery. For autocomplete functionality, I've sued this one successfully: http://www.dyve.net/jquery/?autocomplete Also, look at the plugins page (http://docs.jquery.com/Plugins) and you'll find some more options for this. Rey 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 discuss@jquery.com http://jquery.com/discuss/ -- BrightLight Development, LLC. 954-775- (o) 954-600-2726 (c) [EMAIL PROTECTED] http://www.iambright.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
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 discuss@jquery.com http://jquery.com/discuss/ -- BrightLight Development, LLC. 954-775- (o) 954-600-2726 (c) [EMAIL PROTECTED] http://www.iambright.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/