Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2022 08:42 AM
Hi, i want to show/hide choice list based on the value the user selects, i tried to do it with the below script but its not working, can anyone help me? Thanks in advance.
the script remove but not show when the user selects other values:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
if (newValue == '1' || newValue == '2') {
g_form.removeOption('u_esito', 'istr');
}else{
alert('hi!');
g_form.addOption('u_esito', 'istr','Istruzione');
}
}
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2022 08:48 AM
Please try below code:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
if (newValue != '1' && newValue != '2') {
g_form.addOption('u_esito', 'istr','Istruzione');
} else {
g_form.removeOption('u_esito', 'istr');
}
}
Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2022 08:48 AM
Please try below code:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
if (newValue != '1' && newValue != '2') {
g_form.addOption('u_esito', 'istr','Istruzione');
} else {
g_form.removeOption('u_esito', 'istr');
}
}
Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023