OnChange Client script Not working on MRVS

Manu31
Tera Contributor

Hi Team,

 

I have written on onchange catalog client script on  mrvs variable  set which is not working. Could you please help me on this.

 

Note: Written Onchange script on Variable Set (MRVS)

 

Onchange of Variable - StartDate

 

Catalog sclient script

 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}


alert("Hii");
var res = g_form.getValue('startdate');
var ga = new GlideAjax('global.Test');
ga.addParam('sysparm_name', 'valDateScriptChange');
ga.addParam('sysparm_val', res);
ga.getXML(HelloWorldParse);

function HelloWorldParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
if (answer != "true") {
alert("Start Date cannot be previous");
g_form.clearValue('startdate');
}
}
}

 

 

Script Include

 

var Test = Class.create();
Test.prototype = {
initialize: function() {},

valDateScriptChange: function() {

gs.log("Hiimanu");
var res = this.getParameter('sysparm_val');
var r = gs.dateDiff(gs.now(), res, true) / 86400;
gs.log("Hii" + r);
if (r < 0)
return false;
else
return true;

},


type: 'Test'
};

5 REPLIES 5

kamlesh kjmar
Mega Sage
Mega Sage

Hi @Manu31 ,

 

On change client script do not works on MRVs. Unfortunately we do not have that functionality yet.

 

However as a workaround, you can switch your onchange client script to onSubmit and then it will work whenever you add anything or delete anything in your MRV.

 

I Hope this helps.

 

Please mark this helpful if this helps and Accept the solution if this solves your issue.

 

Regards,

Kamlesh

Hi @Manu31 

 

Could you please update, if you got what you were looking for? If you got your answer then please help us close this thread by Accepting appropriate answer. It helps others having similar issue reach to the right solution.

 

Thanks,

Kamlesh

Hi @Man4,

 

Could you please update, if you got what you were looking for? If you got your answer then please help us close this thread by Accepting appropriate answer. It helps others having similar issue reach to the right solution.

 

Thanks,

Kamlesh

Hi @Man4,

 

This thread is still open. Could you please update, if you got what you were looking for? If you got your answer then please help us close this thread by Accepting appropriate answer. It helps others having similar issue reach to the right solution.

 

Thanks,

Kamlesh