AjaxSelect
September 12, 2006
For a few years now I have been using the ColdFusion ActiveSelect custom tag for dynamically populating drop down boxes. ActiveSelect loads all the options as a wddx object in the JavaScript of the page, and then builds up the options as required. The only problem is that as the size of the select boxes increase, so too does the initial page download, because every possible option needs to be catered for. For some of my pages, this has gradually increased the page size to 700K.
So with all the hype about Ajax, and the fact that I’ve been itching to find the time to give it a go (yes, I know it’s been around for ages, I’ve been busy), I thought it was about time to figure it out. I had a quick look at a few different ColdFusion AJAX implementations, and chose JSMX - mostly because it looked the simplest and I could actually understand the implementation after reading through it once.
I used the ActiveSelect framework as a foundation, which will reduce code change as I migrate. I’ve only got my version up on a single test page so far, but it looks like it’s working quite nicely. I’m looking forward to gettting my feet more into the whole Ajax thing, but I’m busy with a huge ”re-factoring” project at the moment, and I’ll only get around to play with the interface later this year, or beginning of next year.
I’ve zipped up the code I used in case anybody else is looking for a ColdFusion component / custom tag to dynamically fill drop down boxes. I tried to find something similar at first so that I wouldn’t need to do it myself, but couldn’t, so perhaps this will help someone else out. It’s version 0.0.0.1, so I’m not responsible for anything that goes wrong. I’ve called it AjaxSelect until somebody sues me for stealing their name. You’ll need to customise it to get it working in your environment, but it should be a start. And if you think I code badly… ”tell somebody • who cares” :)
.::S::.
PS… doesn’t look like I can upload while I’m not hosting with my own provider, so I’ll find a place to host it later. Who knows, maybe I’ll be up to version 0.0.0.2 by then!