|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
CFC and MG2 where does validation fit in?
HiRichard White 09/06/08 03:02 P hi,Richard White 09/08/08 07:47 A Richard,Jaime Metcher 09/08/08 08:01 P thanks jaime. wow i didnt even know about cfcdev but looks amazing :)Richard White 09/09/08 08:26 A 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 hi, does anyone have any ideas on this? thanks richard ----- Excess quoted text cut - see Original Post for more ----- 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 ----- Excess quoted text cut - see Original Post for more ----- thanks jaime. wow i didnt even know about cfcdev but looks amazing :) thanks again richard ----- Excess quoted text cut - see Original Post for more -----
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||