Note: This entry and the sample application associated with it were written sometime in early 2004. Fusebox 4.1, which I now use, has the ability to call multiple fuseactions and as such, form reuse can be applied without the use of a cfmodule system like the one used in the application. I’m leaving it here, however, as it has historical interest (to me, anyway!). The code in the sample is still in use in a number of places and still doing an outstanding job.
One thing that I was never entirely happy with, even before I started using fusebox, was the methods I used for reusing and validating forms. Session variables often seem to cause more problems than they solve, client variables have the storage issue etc. Using hidden formfields and cfparams involves lots of extra fat-finger work. Some people rely on JavaScript to do their grunt work (I’ll leave that tirade for another day). Instructing the user to hit the back button and fix their mistakes just seems nasty. Now I know that these are not insurmountable issues. But of all the methods I tried, nothing seemed elegant.
I posed the question on the old fusebox mailing list on Topica (now replaced by the web-based forums at http://www.fusebox.org/forums/), and got a variety of responses. I experimented with the best of these suggestions and came up with what I think is a pretty good general-purpose system. I’ve used it on a few projects now, including the Perth International Arts Festival site which has a LOT of complex forms behind it, and I’ve found it works beautifully. In fact, the only thing I’ve found that is better is mixed client and server validation using Flash forms and Flash Remoting, but that’s not somewhere I’m going on a massive scale anytime soon.
This app is for Fusebox 3 only at the moment. There’s actually two new flavours of everybody’s favourite framework out at the moment – Fusebox 4, which is the natural progression from Fusebox 3, and remains a procedural framework; and Mach-ii, which is a totally new, object-orinented framework for CFMX 6.1 only. Now, I haven’t played much with either of these, and I have no idea if the principles behind my little app can still be applied. I suspect that it may have application in Fusebox4, at least. And as soon as I get some time to play, I’ll update this page and possibly a version of the code as well. But for now, I have a lot of apps in Fusebox 3 which are not going anywhere, and I know that many other people are in the same boat, so I don’t imagine this sample app will be going away anytime soon.
You can download a zip file containing the sample application code and an Access datasource and if you have any questions email me – kay@smoljak.com – or leave a comment.
