- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 07:15 AM
Hello All,
I have a requirement as below:
Variable category - option A and B
Variable sub category - options S1,S2,S3,S4
when option A selected , option S1 and S2 will be visible and on option B - option S3 and S4 will be visible.
Both these variables are select box type and options are choices configured.
Please help with the on change client script.
Regards
Souvick
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2023 07:42 AM - edited 05-24-2023 07:42 AM
Try this
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
// Selective options on category
var cat = g_form.getValue('category');
alert('Value of:'+cat);
if (cat == 'A'){
g_form.clearOptions('sub_category');
g_form.addOption('sub_category', 'S1', 'S1');
g_form.addOption('sub_category', 'S2', 'S2');
}
else if (cat == 'B'){
g_form.clearOptions('sub_category');
g_form.addOption('sub_category', 'S3', 'S3');
g_form.addOption('sub_category', 'S3', 'S3');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2023 07:42 AM - edited 05-24-2023 07:42 AM
Try this
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
// Selective options on category
var cat = g_form.getValue('category');
alert('Value of:'+cat);
if (cat == 'A'){
g_form.clearOptions('sub_category');
g_form.addOption('sub_category', 'S1', 'S1');
g_form.addOption('sub_category', 'S2', 'S2');
}
else if (cat == 'B'){
g_form.clearOptions('sub_category');
g_form.addOption('sub_category', 'S3', 'S3');
g_form.addOption('sub_category', 'S3', 'S3');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2023 03:13 AM
Thank you Anurag for your input.
Regards
Souvick