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

jQuery event handlers in Finesse gadgets?

TimoV
Level 1
Level 1

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

TimoV
Level 1
Level 1

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.

View solution in original post

3 Replies 3

Quigath
Spotlight
Spotlight

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

Hi,

The code was included in the original post.

 

Thanks,

Timo

TimoV
Level 1
Level 1

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.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: