Richard, There was a ton of discussion on this just recently - maybe on CFCDEV - so there might be a bit of validation fatigue out there. On the upside, you should find rich pickings in the list archives.
Basically both of your proposed solutions sound fine. If there was a consensus (not sure if there was), I think it would go something like: 1. Your instinct to remove the reusable validation logic from the controller is sound. 2. Putting it in the service is OK 3. Breaking it out into a separate validation object is also OK, and maybe slightly preferable. Jaime > -----Original Message----- > From: Richard White [mailto:[EMAIL PROTECTED] > Sent: Monday, 8 September 2008 9:41 PM > To: CF-Talk > Subject: Re: CFC and MG2 where does validation fit in? > > hi, > > does anyone have any ideas on this? > > thanks > > richard > > > Hi > > > > we have hit a little sticking point with CFC's and model glue 2. > > > > we have an object named subject. > > > > we have created a DAO to handle single record db work and a GW to > > handle all multiple record db work. we also have a service cfc to > > handle the DAO and GW CFC's. > > > > we also have a controller for the interface which listens for events > > on that interface. One of the events listens for the user to edit > > subject details. the listener calls a function in the controller named > > validateAndSave which is where the problem arises: > > > > we want to validate the subject details but we dont want to validate > > them in this controller as there will also be other interfaces in our > > system where we might want to validate the same details, so this > > defeats the object of the cfc's. > > > > so we thought that we could add functions such as validateFirstName, > > validateLastName in the subject services cfc. alterntaively we can > > create a whole new cfc called subject validation cfc and add all > > validation functions in there. > > > > this way, other interfaces can also call these validation functions > > easily and makes logical sense. > > > > we would really appreciate your feedback on what you guys think would > > be the best route, and how you do this? > > > > thanks > > > > richard > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312210 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4