- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2022 02:13 PM
Hi Community,
Need help, I have a variables set, one variable 'Office Location' is reference to cmn_location table and another variable 'ttt' is 'select box' type in which I have added question choices.
The requirement is when the 'Office Location' is china > I have to show option in 'xxx' as > aaa, bbb, Other (default = aaa).
Appriciate any help!
I tried this script but no luck.
Regards,
Rafmine.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2022 06:48 AM
I tried to simplify your script. Try below script.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
g_form.clearOptions('office_location');
return;
}
alert('loopin');
g_form.clearOptions('office_location');
g_form.getReference('office_location', callback);
function callback(gr) {
if (gr.name == 'France') {
g_form.addOption('laptop_keyboard_layout', 'Azerty FR', 'Azerty FR');
g_form.addOption('laptop_keyboard_layout', 'Qwerty US', 'Qwerty US');
} else if (gr.name == 'United Kingdom') {
g_form.addOption('laptop_keyboard_layout', 'Qwerty UK', 'Qwerty UK');
} else {
g_form.addOption('laptop_keyboard_layout', 'Azerty BE', 'Azerty BE');
g_form.addOption('laptop_keyboard_layout', 'Qwerty US', 'Qwerty US');
}
g_form.addOption('laptop_keyboard_layout', 'Other', 'Other');
}
alert('loopout');
}
Hopefully, this will work for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2022 02:13 AM
Hi Muhammad,
Thanks for reply my post, i'm trying with the below code but no luck again. not sure where i'm going wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2022 06:48 AM
I tried to simplify your script. Try below script.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
g_form.clearOptions('office_location');
return;
}
alert('loopin');
g_form.clearOptions('office_location');
g_form.getReference('office_location', callback);
function callback(gr) {
if (gr.name == 'France') {
g_form.addOption('laptop_keyboard_layout', 'Azerty FR', 'Azerty FR');
g_form.addOption('laptop_keyboard_layout', 'Qwerty US', 'Qwerty US');
} else if (gr.name == 'United Kingdom') {
g_form.addOption('laptop_keyboard_layout', 'Qwerty UK', 'Qwerty UK');
} else {
g_form.addOption('laptop_keyboard_layout', 'Azerty BE', 'Azerty BE');
g_form.addOption('laptop_keyboard_layout', 'Qwerty US', 'Qwerty US');
}
g_form.addOption('laptop_keyboard_layout', 'Other', 'Other');
}
alert('loopout');
}
Hopefully, this will work for you.