Rob Gonda's Blog

ajaxCFC significant update: named arguments

I just uploaded a new release of ajaxCFC, and this one carries a rather significant update. I modified the way you pass arguments from JavaScript to your ColdFusion function. Before, due to that you were passing unnamed arguments, you were receiving them in a ColdFusion arguments array; Thanks to Kenton Gray's contribution now you receive all arguments as separate named arguments. The main seller was that you could have built-in validations ... I’m using metadata to retrieve the names of the declared arguments, and if you’re passing more arguments than you declare, they come in as ‘unkwnownXX’, xx being a counter or unknowns. I tested the code in CFMX6, 6.1, and 7, but not yet in Blue Dragon. If any of you could do that for me, it would be greatly appreciated.

Your old code WILL NOT WORK with the new ajax.cfc. You can make it work by one of two methods:
1)    name your arguments and their names in your CF Function. This method is the most advisable.
2)    2 :: the quick method) Remove the args declaration and use the arguments scope as an array by simple removing the args var… use arguments[1] instead of args[1].

Related Blog Entries

There are no trackbacks for this entry.

Trackback URL for this entry:

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
This blog is running version 5.9.003. Contact Blog Owner