04-16-2019 10:58 PM
Has anyone managed to use jQuery event handlers in Finesse gadgets, instead of traditional onclick etc. methods defined inside HTML code?
The problem we're facing is that if we define jQuery event handlers in gadget JavaScript code, the event handler gets executed ok, but after that, we get "Missing or malformed url parameter" message rendered in the gadget (pls see the figure enclosed below).
It seems that finesse generates GET request to URL https://xxx.xxx.xxx.xxx/gadgets/ifr? and as the request does not contain URL parameters, it ends up with HTTP 400 (Bad request)?
The JavaScript code in our sample code is something like the following. We've tried to execute the handler registration in almost every section of the code, and just cannot not get this working. If we define the handler as onclick method in HTML code inside gadget XML, it works just fine.
// JavaScript source code
var finesse = finesse || {};
finesse.gadget = finesse.gadget || {};
finesse.container = finesse.container || {};
/*global logFinesse */
/** @namespace */
finesse.modules = finesse.modules || {};
finesse.modules.TestGadget = (function ($) {
testAction = function () {
console.log("testAction()");
};
/** @scope finesse.modules.TestGadget */
return {
/**
* Performs all initialization for this gadget
*/
init: function () {
var cfg = finesse.gadget.Config;
finesse.clientservices.ClientServices.init(cfg, false);
//$("#testButton").on("click", testAction);
containerServices = finesse.containerservices.ContainerServices.init();
containerServices.addHandler(finesse.containerservices.ContainerServices.Topics.ACTIVE_TAB, function () {
console.log("TestGadget is now visible");
gadgets.window.adjustHeight();
$("#testButton").on("click", testAction);
});
containerServices.makeActiveTabReq();
}
};
}(jQuery));
Solved! Go to Solution.
04-29-2019 10:40 AM
Found a solution in another thread ( https://community.cisco.com/t5/contact-center/finesse-gadget-api-failures/m-p/3847358/highlight/false#M9884 ). Added that type=button definition and the issue went away ... strange.
04-17-2019 09:30 AM
What is an example of an event handler that is failing for you? Please post the code that isn't working.
04-17-2019 09:47 AM
Hi,
The code was included in the original post.
Thanks,
Timo
04-29-2019 10:40 AM
Found a solution in another thread ( https://community.cisco.com/t5/contact-center/finesse-gadget-api-failures/m-p/3847358/highlight/false#M9884 ). Added that type=button definition and the issue went away ... strange.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide