boolean isString(string)
boolean isNumber(number)
boolean validateStringForLength(string,length)
boolean validateNumberForRange(number,min,max)
boolean validateStringForCharacter(string,character)
These are the core of my base validation class. I'll often have more specific validation routines in an application specific validation class, these would often include validateEmail, validateSSN, etc, based on the needs of the application. Frequently, the methods in the application specific validation class use the methods of the base validation class.
At 03:11 PM 10/3/2003 +0100, you wrote:
That sounds good, could you give us some examples of the types of generic validation methods you have in the base class, are they things like email checking, length of strings etc?
Ade
-----Original Message----- From: jeff tapper [mailto:[EMAIL PROTECTED] Sent: 03 October 2003 15:05 To: [EMAIL PROTECTED] Subject: Re: [CFCDev] Data validation
I tend to have a validation method (or more often, several validation methods) which i can call when inserting, updating, etc.
Often, I create a base class with all my generic validation methods, which my other classes then inherit from.
At 09:50 AM 10/3/2003 -0400, you wrote:
>Where is the best place to handle data validation in an object? Should an >object's Save() method be responsible for validating it's internal members >before actually saving or should the calling program call a Validate() >method before attempting to save? > >Any advice is appreciated. > >Thanks, >Phillip > >-- > >Phillip Cave >Director, ColdFusion Development >Macromedia Certified ColdFusion Developer >Carol/Trevelyan Strategy Group >202.448.5212 > >---------------------------------------------------------- >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]
Jeff Tapper [EMAIL PROTECTED] Radio Free Astoria http://radio.tapper.net ========== "They who would give up an essential liberty for temporary security, deserve neither liberty or security" - Ben Franklin
---------------------------------------------------------- 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] ---------------------------------------------------------- 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]
Jeff Tapper [EMAIL PROTECTED] Radio Free Astoria http://radio.tapper.net ========== "They who would give up an essential liberty for temporary security, deserve neither liberty or security" - Ben Franklin
----------------------------------------------------------
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]