Defect #516
callback params need string escaping
0%
Description
callback params need to have escaped out quotes around them. so the sample code is wrong:
var jsToExecute = "var sum = 1 + 2";
plugins.WebClientUtils.executeClientSideJS(jsToExecute, myCallBackMethod, ['sum'])
corrected sample code:
var jsToExecute = "var sum = 1 + 2";
plugins.WebClientUtils.executeClientSideJS(jsToExecute, myCallBackMethod, ['\"sum\"'])
History
Updated by David Workman almost 13 years ago
my bad, this is working correctly. the trick is unescaped parameters need to match a variable set in the js to execute. so this works:
var jsToExecute = "var sum = 1 + 2";
plugins.WebClientUtils.executeClientSideJS(jsToExecute, myCallBackMethod, ['sum'])
// sum = 3
this works:
var jsToExecute = "var sum = 1 + 2";
plugins.WebClientUtils.executeClientSideJS(jsToExecute, myCallBackMethod, ['\"sum\"'])
// sum = "sum"
this doesn't work:
var jsToExecute = "var sum = 1 + 2";
plugins.WebClientUtils.executeClientSideJS(jsToExecute, myCallBackMethod, ['product'])
// callback method doesn't get executed
this works:
var jsToExecute = "var sum = 1 + 2";
plugins.WebClientUtils.executeClientSideJS(jsToExecute, myCallBackMethod, ['\"product\"'])
// callback is executed