Onchange Client script response

String
Kilo Sage

Hi All ,

Am using the below code in Catalog Client Scripts (variable set) onchange and using the below code 

 

 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
// This is used for Consumable Ordering Portal
var cons = g_form.getValue('u_test');
// Call script include
var ga = new GlideAjax('test'); // Script include
ga.addParam('sysparm_name', 'getcount'); // Method
ga.addParam('test1', cons);
// Execute asynchronously
ga.getXML(getResponse);
}
function getResponse(response) {
var answer = response.responseXML.documentElement.getAttribute('answer');
g_form.setValue('total', answer);
}
 
 
when Item field is changed ,than above on change script will trigger and get the value set to total field ,But I need to click anywhere on the screen .so value is set to total field
after changes the item value ,use directly click on submit than total field is empty 
 
Is there any way when Item filed changes than immediately it should trigger and set the value in total field 
5 REPLIES 5