> Right - can do this, Display form post to Action form. Action form creates > FormValidator object and call validate.
There is one sticking point with this that I've found if you're not using a single controller for your app or at least for your form. If you approach is this: 1. Present user with form at /form.cfm 2. Submit to /action.cfm 3. Perform validation 4a. If true, do action 4b. If false, redirect to /form.cfm, preserving form state, and displaying errors messages 4b ends up getting complicated if you have text inputs or textareas that allow for very lengthy values. When validation fails and you do that redirect, you either need to (1) pass the user's form values in the query string, or (2) create session variables to hold those values. Option 1 is bad because if you are passing back very large amounts of data in the query string it can actually cause your webserver to error out because the query string is too long. Option 2 is bad (IMHO) because using session variables starts to get very messy, especially if you have a lot of forms in your app that use this framework. Counterpoint: if you're building multipage wizards, some people prefer to use session variables so the user can go forward and back through the form without writing complicated code to manage hidden form fields and be passing things around all over the place. Phew! So, taking that into account, my preferred approach is to use a single URL (ie /form.cfm) and do the "form" view or "action" based on a FORM or URL variable value. That way the form always submits to itself and the variables are always available in the FORM scope. So what this amounts to is creating a single "controller" just for your form and action... much like you use a single controller for an entire Mach-II app. If you want or need more detail feel free to contact me off-list and I can discuss the architecture that I used pre-Mach-II. I could probably write a short novel on this topic but I don't want to spam the list too horribly :) -Cliff ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). CFCDev is supported by New Atlanta, makers of BlueDragon http://www.newatlanta.com/products/bluedragon/index.cfm An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
