> Thoughts from the masters on this? Is having a CFC with a one-to-one mapping of form fields to properties in the CFC worthwhile > or just overhead? I'm guessing this is a loaded opinionated question, but still, I'd like to see some thoughts.
Don't think I ever want to promote myself as a "master" but I will throw my hat into the ring on this one. I would basically use a "base" class for an "interface" and then have a single level of inheritance for each specific form. What you would then do is create the "schema" for the form as part of the derived classes initialisation and/or (as I have seen done elsewhere) use the <CFPROPERTY> tag and GetMetaData function as your "schema" mechanism. In either case your class would have information in it that describes the schema of your multi-part form and would work with this information (rather than member variables). The information you need about a form field is "rich" in it's own right and I dont believe that a simple member inheritance will give you enough information to control the form properly. I previously did something similar to this in CF 4.5/5.0. In this case, the "class" was just a member variable of Session and the generic code simply just dumped the contents of the form (minus submit buttons) into the Session variable. Then, you simply had a database table with the same schema (and naming) of the form, and had a generic "INSERT" statement to put it into the database. I have recently duplicated the concept in CFMX for a survey tool we are using and used CFC's. However, I carried the "attribute" concept over into the database side of things (so that I can reuse the same schema for any survey I like without having to worry about the specific fields in a survey). This also makes "complex" reporting a little easier because I can actually compare between surveys without regard for schema. All the data is just stored in attribute/value pairs in a generic table. The schema itself is also stored in database tables along with rich information about workflow (controlling which parts of the form appear on other answers). In my case, this mechanism has never required "editing" so I didn't have to worry about an "UPDATE" statement. If you required "editing" and/or intermediate storage of the data (e.g. maybe they can start it and come back and complete it later) then I would suggest a mechanism that used WDDX to store the "work in progress" until it was ready to commit to your database. The WDDX could be stored in the file system or in a separate database table. You would not want to store the completed form as WDDX because this would make it much more difficult to report on later. Hope the above helps. Gary Menzel Web Development Manager IT Operations Brisbane -+- ABN AMRO Morgans Limited Level 29, 123 Eagle Street BRISBANE QLD 4000 PH: 07 333 44 828 FX: 07 3834 0828 **************************************************************************** If this communication is not intended for you and you are not an authorised recipient of this email you are prohibited by law from dealing with or relying on the email or any file attachments. This prohibition includes reading, printing, copying, re-transmitting, disseminating, storing or in any other way dealing or acting in reliance on the information. If you have received this email in error, we request you contact ABN AMRO Morgans Limited immediately by returning the email to [EMAIL PROTECTED] and destroy the original. We will refund any reasonable costs associated with notifying ABN AMRO Morgans. This email is confidential and may contain privileged client information. ABN AMRO Morgans has taken reasonable steps to ensure the accuracy and integrity of all its communications, including electronic communications, but accepts no liability for materials transmitted. Materials may also be transmitted without the knowledge of ABN AMRO Morgans. ABN AMRO Morgans Limited its directors and employees do not accept liability for the results of any actions taken or not on the basis of the information in this report. ABN AMRO Morgans Limited and its associates hold or may hold securities in the companies/trusts mentioned herein. Any recommendation is made on the basis of our research of the investment and may not suit the specific requirements of clients. Assessments of suitability to an individual's portfolio can only be made after an examination of the particular client's investments, financial circumstances and requirements. **************************************************************************** ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
