Hide options from Select box variable depending on the option selected from previous select box
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 09:22 PM
My requirement is that i have two select box variables Platform name and work request depending on the selection in variable Platform name, the options in work request should be shown or hidden.
Please advise how to achieve this via client script
Below script implemented but if i change selection multiple times its not working. Please advice where the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2024 11:58 PM
Hi,
I also had the same requirement but a small change if i select a variable then another variableset to be hidden. can anyone help me please
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 04:32 AM
Hi @KM10
I understand you have a similar requirement, and I'd be happy to assist you. I will provide you a reply on your thread.
Thank You!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 09:47 PM
@Aniket Chavan its not working. Do we need to mention clear function ? Please help me with script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 09:46 PM
for g_form.addOption() function, you need to indicate both display value and actual value. Something like below.
g_form.addOption('field_name_of_dropdown', 'display_name_of_dropdown_option', 'actual_value_of_dropdown_option') ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 12:02 AM - edited 01-30-2024 12:13 AM
Hello @Krishna Priya ,
Kindly test the updated script provided below. Ensure that you verify the backend names of your variables and replace them accordingly. I've successfully tested this functionality with two select box variables on my end, and it performed as expected. Let me know how it works for you.
function onChange(control, oldValue, newValue, isLoading) {
// Check if the form is still loading or if the new value is empty
if (isLoading || newValue === '') {
return;
}
// Get the value of the 'platform_name' field
var platform = g_form.getValue('Platform_name');
// Define the field for 'work_request'
var workRequestField = 'work_request';
// Add options based on the selected platform
if (platform === 'Email') {
g_form.removeOption(workRequestField, 'domain');
g_form.addOption(workRequestField, 'Data', 'Data');
g_form.addOption(workRequestField, 'Email', 'Email');
} else if (platform === 'Endpoint') {
g_form.removeOption(workRequestField, 'Email');
g_form.addOption(workRequestField, 'Data', 'Data');
g_form.addOption(workRequestField, 'domain', 'domain');
}
}
Additionally, I recommend exploring the following links, which provide detailed insights into the syntax and usage, making it easier for you to understand and implement:
- How to add option, remove option, get display Value, Clear Option in Choice List?
- Removing or Disabling Choice List Options
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks,
Aniket