cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
266
Views
0
Helpful
3
Replies
Beginner

jQuery event handlers in Finesse gadgets?

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));

 

finesse_handlers.png

1 ACCEPTED SOLUTION

Accepted Solutions
Beginner

Re: jQuery event handlers in Finesse gadgets?

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.

3 REPLIES 3
Enthusiast

Re: jQuery event handlers in Finesse gadgets?

What is an example of an event handler that is failing for you? Please post the code that isn't working.

Highlighted
Beginner

Re: jQuery event handlers in Finesse gadgets?

Hi,

The code was included in the original post.

 

Thanks,

Timo

Beginner

Re: jQuery event handlers in Finesse gadgets?

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.

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards