So I have found a bug in AjaxCFC and I am not sure if it is known or not. When passing more than 9 inputs into your AJAX call, they are sorted wrong like so:
Input 0 Input 1 Input 10 Input 11 Input 12 Input 13 Input 2 Input 3 Input 4 Input 5 Input 6 Input 7 Input 8 Input 9 10, 11 etc as text are alphabetically before 2, 3, 4 etc. And of course 0 and 1 would be first. Turns out the offending bit of code is in the parseURL function, where an array of parameters is sorted AS TEXT like so: <cfset arraySort(paramsArray, 'textnocase') /> Has anyone had this happen to them before? My work around until I fixed the function was just to build a JS object and pass it in as the only input, which then simply becomes the arguments struct where the keys equal the attributes of the inputted object. My new parseURL function is below. It is one of a few ways to solve the problem, but it would allow for unlimited inputs as long as the internal naming conventions never change. I E-mailed Rob Gonda, but I haven't heard back from him. There also appears to be a bug Report at the RIAForge Forums. I suppose I should post there as well. ~Brad <cffunction name="parseURL" access="private" output="No"> <cfargument name="objURL" required="Yes" type="struct" /> <cfset var params = arrayNew(1) /> <cfset var numParams = 0 /> <cfset var i = 0 /> <cfset var result = structNew() /> <!--- Count the number of times "C0-PARAM" exists. This is the number of input params. ---> <cfset numParams = ListValueCountNoCase(rereplace(structKeyList(objURL, ","),"C0-PARAM[0-9]*","C0-PARAM","all"), "C0-PARAM" , ",")> <!--- Go and get them all in the CORRECT order. ---> <cfloop index="i" from="1" to="#numParams#" step="1"> <cfset params[i] = parseParam( objURL["C0-PARAM"&i-1] ) /> </cfloop> <!--- <cfset var paramsArray = StructKeyArray(objURL) /> <!--- This line will MIS-SORT all parameters over 9 ---> <cfset arraySort(paramsArray, 'textnocase') /> <cfloop from="1" to="#arrayLen(paramsArray)#" index="i"> <cfif left(paramsArray[i], 8) eq "C0-PARAM"> <cfset arrayAppend(params, parseParam( objURL[paramsArray[i]] ) ) /> </cfif> </cfloop> ---> <cfset result.method = duplicate(objURL['C0-METHODNAME']) /> <cfset result.id = duplicate(objURL['C0-ID']) /> <cfset result.params = params /> <cfreturn result /> </cffunction> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264921 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4