Roland, once again you have shone the light on my erred ways.  ;^)

<cop-out>You see, it's just that I have this chick from admissions that keeps 
bugging me with her requests and I don't have time to think clearly 
today.</cop-out>

M!ke 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Roland Collins
Sent: Wednesday, May 11, 2005 2:31 PM
To: [email protected]
Subject: RE: [CFCDev] Form Validation



>�It depends on how your bean is populated.� If I'm populating from a 
>form,
I'll usually set the data >type to "any" for a date field to accept anything 
(unless I'm sure it's really a date - such has a js >calendar event etc).� I 
use "any" to show a difference between plain old strings and something
>special being done in the validate.

>Good idea.  "Any" appears better than "String" for those values. "Any"
seems more ambiguous which is 
>exactly what form data is.

I disagree - Any is far _too_ ambiguous.  Also, as far as ambiguity, all values 
in a user-submitted FORM struct are cast as simple types (strings).
Allowing the use of "Any" opens up your code to all kinds of scary validation 
errors.  I could pass in an array, a Struct, a java object, a COM object, or a 
CFC if I wanted to.  In fact, if I was just looking at the signature for your 
code, I might think that I _could_ pass in any of those, since Any allows that. 
 That's a contract violation.  Even if your validation routine checks IsDate() 
or IsString() (or something to that effect), what's the point of allowing 
objects to be passed in the first place then?

I would always use the most restrictive type that can be allowed for these 
types of validation routines.  In this case, that is a string.  All dates can 
be represented by a string - especially in CF.

Roland


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to