OnChange Client script Not working on MRVS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2022 10:38 PM
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'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2022 10:46 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2022 07:16 AM - edited 10-28-2022 07:17 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2022 04:24 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 07:26 AM
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