CFFUNCTION and CFARGUMENT don't support new types in ColdFusion 7
April 13, 2005
One thing I just realized today - that is a bummer, is that the new types supported by
IsValid (eg integer, email, zipcode) in ColdFusion 7 are not supported by the
returntype attribute in
CFFUNCTION, and not supported in the
type attribute of
CFARGUMENT. Whats up with that?
Trackback Address: 322/EFB548E26FFE413AD140AC5C99890B0F
That's exactly what I suspected half a year ago (see my comment at http://www.forta.com/blog/index.cfm?mode=e&entry=1386 ). :(
We thought about this, but realized there was one problem with it. WebServices. The cfargument types need to be converted to wsdl types when you ask CF to convert the CFC to a webservice. And wsdl doesn't have an email type or a regex type (with your custom pattern), for example.
This is one reason for isValid(), so you can still run validation inside your cfc methods as needed.
Thanks Mike, that makes sense. Though, some of the types such as integer are WSDL types, and would be useful to be able to specify.
your right. I'll submit an enhancement list to see if we can't add a few of them.
How about conditional type attribute options for cfargument tag dependent on cffunction's access attribute? So you could use the new validation types for all functions except such that are used for a webservice.
This is a non-problem when coding using <cfscript> functions such as inside components because ColdFusion doesn't care what the types of variables are when processing <cfscript> return types or the like.
I can post samples to demonstrate this if necessary...
Hey Mike, when you convert the CFC to a webservice, why don't you just simplify the new type to whatever it could generically fit in, like a email & zipcode are strings. Then in the generated webservice code automatically call the equivilant of isValid() for the additional validation, instead of making developers repeat the same steps manually in cfml?
This airtlce went ahead and made my day.