The category field is a very special one. The usual onChange event customization doesn't work, because
1) autofill is disabled
2) the OOTB onChange event is defined to launch
change_category_func whose principal purpose is to display
load_properties.htmpl which is designed to fill the
Properties tab if area properties are defined.
3) that prevents any additional custom javascript code to run, but I haven't spent the time to find all use cases.
The only safe way I've found so far to do things after the category has changed is to add custom code to
load_properties.htmpl. In that page,
$args.category links to the category record in use in the call_request.
Hope that helps
Original Message:
Sent: 03-24-2017 12:47 AM
From: Balram Singh Deswal
Subject: Re: How to Call Javascript Function on Change of Lookup?
Hi Chen,
I am able to call my function on Incident area field using the following code:
<PDM_MACRO name=dtlHier hdr="Incident Area" attr=category autofill=no evt="onChange=\\\"change_category_func('in',null,'pcat_in'); myFunction()\\\" onBlur='calculateUrgency()'" factory=pcat_in>
But, it is causing the same issue as it is giving for lookup field of affected end user that I explained to Lindsay_Estabrooks in my previous comment.
Although it is working, but it is being called twice each time I change the value after typing the keys in the text field and picking my value from the autofill options. Apart from this, it is not getting called when I am changing the value using the link option which opens the pop up to select the incident area. How to call this function in this case also? Why the function is getting called twice when I am using autofill option? It is called when I click the option in the autofill options, and immediately again after that.
Thanks & Regards,
Balram