There was a recent discussion on our CF User Group list that regarding a general purpose form generation tool that could store form definitions in XML and be used to abstract the form logic and circumvent the tedious process of writing forms. I for one HATE writing forms- it’s just one step above cleaning the bathroom on my list of “mindless, repetitive yet necessary annoyances.” So basically I had this same idea a couple years ago to distill the logic of forms down to the critical portions that change from instance to instance and then write a very simple message format and engine for storing form definitions in XML and then rendering them to a browser. I called this project Instaform and from the recent renewed interest in this technique on the AZCFUG list, I have dug up the code and made it freely available here.
A couple things:
Just for background, the birth of this concept for me came after I had played around with a tool that was used to develop a Macromedia developer survey I had taken. The tool InfoPoll.com’s windows client for creating surveys that could be hosted on their site. At the time I was sick of writing forms and facing the need to make a ton of forms for various projects I had while working for Act.com. I was also reading a book on design patterns. that gave me this whole idea for “encapsulating the variation” in systems. When I used the Infopoll client, it made me realize that form elements are really just different variations of the same class and that surveys are composed of questions and common form object blocks which consist of these elements. Adding new elements was just a matter of writing the necessary “handlers” for displaying them. The result was some tinkering that lead to Instaform. I have since seen a better implementation of the same idea called Facile Forms which is really worth checking out if you’re serious about this stuff. Facile Forms is an add-on component to the php-based Mambo framework (i know i know, not cf…) and it achieves the same thing as InstaForm plus some added advantages like:
-a nice GUI for administration
-extensible validation scripts
-automatic handling of the database logic for storing responses
-a slick mechanism for sharing and deploying forms via XML
-positioning information to place the form elements where you want
-support for multi-step “wizard” forms
Feel free to try out InstaForm – if it gives you an idea you can use, great. I made this same disclaimer on the azcfug list:
1. it was pre-cfmx when it was written and therefore did not make use of cfc’s and the cfxml tags since they did not yet exist. Instead it relied upon a tag from SiteObjects called “soxml” that was a wrapper for the MSXML com object that parses XML.
2. I haven’t actually tested it since 2002 so the code may need tweaking to work
3. I don’t see what harm could come from playing with it, but I suppose I need to make the standard “use at your own risk” disclaimer and I’m not responsible if something breaks.
What would be really cool is if someone would port the Facile Forms component to ColdFusion and sell it as a mini-app or customtag. Anything to eliminate the tedium of forms is money well-spent.