Hey all,
So, in concert with another group of developers (that work on the same
server), we put together a "format.cfc" that just handles a lot of the
basic format things we do - things like outputting a phone number in a
specified format, capitalizing this thing we use called a netid -
stuff like that.

It turns out that the other developer thinks that you should never use
a format function to do any validation. In other words, if you pass an
empty string to a phone() function, it should return "()-" instead of
returning an empty string. All the functions that insert stuff are set
up that way.

So, I'm thinking about that. And, I was darn sure that they shouldn't.
Then, I tried a few of the built in functions (dollarformat(),
decimalformat(), numberformat()) and it turns out that they all give
you back zero, formatted, if you pass in an empty string.

So, what do you think? Should you have to write:

<cfif len(myphone)>
#phone(myphone)#
</cfif>

Or, should you just be able to call #phone(myphone)# and have it
return an empty string if it's passed an empty string. What's your
best practice?
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to