>�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]
