- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 09:09 AM
Hi All,
I am using onChange catalog client script on Var1. However, clearValue for Var2 is not working onChange.
Below is the Script. Kindly help.
g_form.clearValue('Var2');
g_form.clearOptions('Var2');
if (newValue == '1' || newValue == '2') {
g_form.addOption('Var2', '2', 'XYZ', 1);
} else if (newValue == '3') {
g_form.addOption('Var2', '1', 'XYZ', 1);
} else if (newValue == '6') {
g_form.addOption('Var2', '0', 'XYZ', 1);
} else {
g_form.addOption('Var2', '0', 'XYZ', 1);
g_form.addOption('Var2', '1', 'XYZ', 2);
g_form.addOption('Var2', '2', 'XYZ', 3);
g_form.addOption('Var2', '3', 'XYZ', 4);
g_form.addOption('Var2', '', '-- None --', 0);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 11:15 AM - edited 09-18-2023 11:16 AM
Hi @Mohammed Masi U ,
No i meant instead of clearValue or clearOptions can u try remove option for Var2
Please mark my answer helpful if it satisfies your requirement
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 09:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 10:51 AM
Hi @Danish Bhairag2 ,
Do you mean to use removeOption instead of addOption? If yes, how do I write an else statement?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 11:15 AM - edited 09-18-2023 11:16 AM
Hi @Mohammed Masi U ,
No i meant instead of clearValue or clearOptions can u try remove option for Var2
Please mark my answer helpful if it satisfies your requirement
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 11:25 AM
It worked! Thanks.