addEventListener not working in Service Portal

Manar Elkhalifa
Tera Contributor

 

Hi everyone,

I'm working with a catalog item and trying to perform a calculation whenever a user types into a single-line text box variable. Here's what I did:

 

var s = g_form.getControl("variable_name");
s.addEventListener('keyup', functionName);

function functionName() {
  alert('inside function');
}

This works perfectly in the Catalog Item (Try It) view.

However, when I try the same in the Service Portal, it throws an error:
TypeError: s.addEventListener is not a function.

I understand that onChange only triggers when the field loses focus or when the user clicks elsewhere, which is why I used addEventListener to detect keystrokes directly.

Does anyone know why this approach works in the regular catalog view but not in the Service Portal? Or is there a recommended way to handle keyup or live input tracking in the Service Portal?

Thanks in advance for your help!

0 REPLIES 0