It's because you mean two different things when you say "validation"
1) format checking or type safety - i.e. the contents of the User.email field must be a syntactically valid email, not just any old string. 2) business rules - i.e. "only an administrator can create User with an email from a different domain than his/her own" Type one belongs in the object itself, type two belongs outside. my 0.02$, /t >-----Original Message----- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf >Of Peter J. Farrell >Sent: Wednesday, February 28, 2007 11:48 PM >To: [email protected] >Subject: Re: [CFCDEV] Where should I validate form submissions? > >Nando said the following on 2/28/2007 4:32 PM: >> Why shouldn't a user know how to validate it's own data? >To me it depends on how much you need to validate your bean. We have >some pretty complex validation routines in one our applications. We >needed access to UDFs, which felt dirty to inject in the bean (I know >that Peter Bell would disagree), manage UDFs inside the bean or use >cfinclude (could cause namespace issues). We also sometimes have to do >more complex things -- like checking if the password meets our >requirements -- all the normal stuff plus things like not allowing >stupid words like first/last name, email address or current user name. >All of this requires access to things external to the bean -- this of >course is overly simplified for illustration purposes in this >email. So >after a while, letting the bean know how to validate itself became >unreasonable for us. In the end, we don't mind that our beans are very >stupid and a bit anemic. Those are my two cents and I'm sure in the >future I'll have more to say. >> Maybe you could try both approaches and see which you like better? >Most definitely. Trying is the only way you learn otherwise we can >debate this forever! ;-) > >.Peter > >-- >Peter J. Farrell - Maestro Publishing >http://blog.maestropublishing.com >-- >Co-Host of the ColdFusion Weekly Podcast >http://www.coldfusionweekly.com You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
