A Facebook-Like List auto complete Using FCBKcomplete, JQuery and Coldfusion
Friday 25 February 2011 05:19 PM
FCBKcomplete is a JQuery-based, Facebook-like, AJAX-capable auto complete input file––and it’s beautiful! Click here for the demo page. Click here to download. Emposha, the brilliant dude behind this neat piece of coding, releases regular updates, so be sure to download the latest version. For this post, I’m using the most current version as of today, 2.7.4
I’m trying to create a simple ColdFusion wrapper for FCBKcomplete, write a CFC file to grab data from one of my tables, and then pass the data to FCBKcomplete. First things first, I need to include JQuery. I use JQuery on most of my web pages, so I include JQuery on top of my page in a header template. I'm not going to include JQuery in the wrapper.
Coldfusion 8 and higher are capable of returning JSON-formatted data on demand. If your version is 7 or older, you need to use cfjson.cfc. Next, here is the Keywords.cfc file. Since FCBKcomplete Ajax requests require JSON Array with the variable [caption] for a display name and the variable [value] for a value ID, I converted my query results into an array.