> Not all of us, ie I'm Awustraaliaan mate ;) hehhe.
Ooops. I'm just a damn yankee living in my own little world. ;-)
>Personally i think the UDF should simply throw an exception that or
return a contract back out
>result.data = "any data you manipulated or sent in originally"
Is it "bad form" to return ONLY the original input in case the input did
not follow the "rules" rather than throw an exception?
For example:
<cffunction name="ssnFormat" returntype="string" access="public"
output="no">
<cfargument name="ssn" type="numeric" required="yes">
<cfreturn reReplace(arguments.ssn,
"^([0-9]{3})([0-9]{2})([0-9]{4})$", "\1-\2-\3")>
</cffunction>
This function returns a hyphenated SSN, only if the regular expression
matches. If not, it just returns the original data.
>My personal preference is to throw an exception (its not really a hard
error, its more of a "ooops" hiccup), that way that UDF is used
universally and no constraints are put in place (ie if you use the
contract, whenever you use it now it also has to adhere to the result
stack). Its then up to the end user to cater to its needs (ie i think
the same rule applies with say a method expecting a numeric value and
you pass in a string, syntax is out so it throws an exception).
I kind of like this idea. I will play around with it today.
> So, If a user passes in 4 digits only, then you could assume to return
a masked version (why i have no idea).
I would never pass in only 4 digits, however, a valid SSN may have
leading zeros. If I store the SSN in a numeric DB field, the leading
zeros are dropped. I would still want to pass the less-than-nine-digit
SSN to the function to display only the last four digits. This is more
for verification of an SSN for an administrator to determine if the
person's record is the one they actually need. I don't want to expose
their entire SSN for privacy reasons.
Thanks
MAD
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words '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
[EMAIL PROTECTED]