Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cfc function not receiving arguments when called from javascript via cfajaxproxy

I started getting this problem when I installed ColdFusion 2016 Update 4.

HTML:

<input type='button' name='btn' value='Click me' onclick='proxyFunc();'>

Proxy:

<cfajaxproxy cfc='proxy' jsClassName="jsProxyClass" >

Javascript:

proxyFunc = function () {
  var proxyObj = new jsProxyClass();
  proxyObj.setHTTPMethod("post");   
  proxyObj.setCallbackHandler (function (result) {
      console.log(result);
  });
  proxyObj.func('X');
}

CFC:

<cffunction name='func' access='remote' returntype='string' >
  <cfargument name='arg' type='string' required='false' >

  <cfreturn 'What is my arg? ' & arguments.arg>
</cffunction>

I set a breakpoint on in my cfc and found that arguments.arg is blank and I have form.argumentcollection = {"arg":"X"}

If I change setHTTPMethod from "post" to "get", arguments.arg = "X", as I would expect.

I have a lot of code that has been working fine before this CF update, and now it's all broken :(

Any help would be appreciated. Thanks in advance.

like image 544
Steve Teraji Avatar asked Aug 30 '17 17:08

Steve Teraji


1 Answers

I found this patch that Adobe posted https://tracker.adobe.com/#/view/cf-4198589 , and it worked for me.

like image 139
Steve Teraji Avatar answered Sep 29 '22 01:09

Steve Teraji