Kay lives here

working with the web

Fusebox Form Reuse

Note: This entry and the sam­ple appli­ca­tion asso­ci­ated with it were writ­ten some­time in early 2004. Fuse­box 4.1, which I now use, has the abil­ity to call mul­ti­ple fuse­ac­tions and as such, form reuse can be applied with­out the use of a cfmod­ule sys­tem like the one used in the appli­ca­tion. I’m leav­ing it here, how­ever, as it has his­tor­i­cal inter­est (to me, any­way!). The code in the sam­ple is still in use in a num­ber of places and still doing an out­stand­ing job.

One thing that I was never entirely happy with, even before I started using fuse­box, was the meth­ods I used for reusing and val­i­dat­ing forms. Ses­sion vari­ables often seem to cause more prob­lems than they solve, client vari­ables have the stor­age issue etc. Using hid­den form­fields and cfparams involves lots of extra fat-finger work. Some peo­ple rely on JavaScript to do their grunt work (I’ll leave that tirade for another day). Instruct­ing the user to hit the back but­ton and fix their mis­takes just seems nasty. Now I know that these are not insur­mount­able issues. But of all the meth­ods I tried, noth­ing seemed elegant.

I posed the ques­tion on the old fuse­box mail­ing list on Top­ica (now replaced by the web-based forums at http://www.fusebox.org/forums/), and got a vari­ety of responses. I exper­i­mented with the best of these sug­ges­tions and came up with what I think is a pretty good general-purpose sys­tem. I’ve used it on a few projects now, includ­ing the Perth Inter­na­tional Arts Fes­ti­val site which has a LOT of com­plex forms behind it, and I’ve found it works beau­ti­fully. In fact, the only thing I’ve found that is bet­ter is mixed client and server val­i­da­tion using Flash forms and Flash Remot­ing, but that’s not some­where I’m going on a mas­sive scale any­time soon.

This app is for Fuse­box 3 only at the moment. There’s actu­ally two new flavours of everybody’s favourite frame­work out at the moment — Fuse­box 4, which is the nat­ural pro­gres­sion from Fuse­box 3, and remains a pro­ce­dural frame­work; and Mach-ii, which is a totally new, object-orinented frame­work for CFMX 6.1 only. Now, I haven’t played much with either of these, and I have no idea if the prin­ci­ples behind my lit­tle app can still be applied. I sus­pect that it may have appli­ca­tion in Fusebox4, at least. And as soon as I get some time to play, I’ll update this page and pos­si­bly a ver­sion of the code as well. But for now, I have a lot of apps in Fuse­box 3 which are not going any­where, and I know that many other peo­ple are in the same boat, so I don’t imag­ine this sam­ple app will be going away any­time soon.

You can down­load a zip file con­tain­ing the sam­ple appli­ca­tion code and an Access data­source and if you have any ques­tions email me — kay@smoljak.com — or leave a comment.