- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2016 07:17 AM
We have a request to remove an option from select box B if a user selects a specific option in select box A.
Here's the client script I created, but it doesn't seem to be working. For testing, I tried changing onChange to onCellEdit and onLoad but nothing worked.
the g_form.removeOption is working. The option is removed if I comment out the if statement and force the removeOption through.
function onChange(control, oldValue, newValue, isLoading) { |
var phoneUser = g_form.getValue = ('phone_user_type');
if (phoneUser == 'CCE Phone User') {
return g_form.removeOption('desk_phone', 'reconfigure');
}
}
Thanks in advance
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2016 10:22 AM
Oops, you need use label too. Use this. Please mark this one as correct, so that others who have same issue can find the right one
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var phoneUser = g_form.getValue('phone_user_type');
if (phoneUser == 'cce_phone_user') {
g_form.removeOption('desk_phone', 'reconfigure');
}
else{
if(!g_form.getOption('desk_phone','reconfigure')){
g_form.addOption('desk_phone','reconfigure','Put the label for the choice here');
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2016 07:51 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2016 08:06 AM
Use choice value of "CCE Phone User". I believe it is the choice label.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2016 09:59 AM
Got it, just had to change the if statement from:
if (phoneUser == 'CCE Phone User') {
To:
if (phoneUser == 'cce_phone_user') {
Thanks again for the quick help everyone.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2016 10:00 AM
Glad you go it working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2016 10:06 AM
One small issue, if you revert the 'phone_user_type' from 'cce_phone_user' to another option in the select box, the 'reconfigure' value is still missing from the dropdown. The user would have to reload the form in order to get the 'reconfigure' option back.
I'm not sure if I would have to add an else or while statement and use the addOption command or what. Any help would be amazing as I'm clearly not a pro scripter