Why Onchange Script runs while reloading the page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 02:06 AM
Hi,
I have written an onchange client script code to populate some info message when some conditions are met.
But the info messages are populated while reloading the page.
//Script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
var cat = g_form.getValue('category');
var sub = g_form.getValue('subcategory');
var bs = g_form.getValue('business_service');
var grp = g_form.getDisplayBox('assignment_group').value;
var usr = g_form.getValue('assigned_to');
if (cat == 'hardware' && sub == 'broken device (unusable)' && bs == '026bab04db3044102db740a505961975' && grp.startsWith('TCS') && usr == '') {
g_form.addInfoMessage(getMessage('breakfix'));
}
//Type appropriate comment here, and begin script below
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 02:10 AM
Hi @Linga Suvetha1 ,
Can u replace the code with below n check if it still runs?
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var cat = g_form.getValue('category');
var sub = g_form.getValue('subcategory');
var bs = g_form.getValue('business_service');
var grp = g_form.getDisplayBox('assignment_group').value;
var usr = g_form.getValue('assigned_to');
if (cat == 'hardware' && sub == 'broken device (unusable)' && bs == '026bab04db3044102db740a505961975' && grp.startsWith('TCS') && usr == '') {
g_form.addInfoMessage(getMessage('breakfix'));
}
//Type appropriate comment here, and begin script below
}
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 02:28 AM
Hi Danish,
Thanks for the reply..But the issue is still there..
The onchange script still popup the message while loading the page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 02:32 AM
Hi @Linga Suvetha1 ,
Can u share the snip of ur whole code plz i mean the whole page of onchange script & also the popup message which is appearing.
Thanks,
Danish