functions, cfcs, components, cffunction, cfcompnent, cfargument, lists, tricks, secrets, unknown, tips, interesting, uncommon, undocumented
I discovered a useful undocumented behavior of Coldfusion components today! It turns out that if you define the value of a named argument more than once in a remote method call (via GET or POST), those values will be passed as a comma-delimited list. This behavior is different than how Coldfusion would treat argument multiples in every other function call--normally, Coldfusion either overwrites arguments with their last defined value or throws an error.Here is an example:
example.cfc
<cfcomponent>
<cffunction name="test" access="remote" returntype="any">
<cfdump var="#arguments#">
</cffunction>
Then simply type something like this as a url to call the above component: http://www.yourdomain.com/
example.cfc?method=test&a=1&a=2&a=oh&a=3
This is what you'll see:

kinda cool, huh?
I've tested this behavior in Coldfusion MX 6.1 and MX 7. If anyone out there would like to test it on MX 8 and let me know how it works, that would be great!
0 comments:
Post a Comment