- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2016 08:12 AM
I have an onChange script I'd like to run on a catalog item but my script doesn't seem to be working. Any thoughts?
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var type = g_form.getValue('employee_type');
if(type == 'Contractor' || type == 'Consultant'){
g_form.removeOption('company','92944b3937e4c280e96da6d2b3990ecf');
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2017 11:25 AM
No I don't think that is possible. Since it is a reference field but you are just displaying it as a drop down menu. You need to use reference qualifier on this field. But I don't think you can dynamically remove the option yet not removing the record from the reference table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2016 08:24 AM
Hi,
Try to replace the sys_id from choice value, which you want to remove.
removeOption(fieldName, choiceValue)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2016 08:27 AM
Thanks, I tried that and it still didn't work. I also added an else statement to see if that was needed and it's still not hiding the value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2016 08:52 AM
Hi,
Try putting alert statements inside if to see whether it matches the condition or not.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue != oldValue)
{
var type = g_form.getValue('employee_type');
if(type == 'Contractor' || type == 'Consultant')
{
alert('inside if');
g_form.removeOption('company','<choice value>');
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2016 09:09 AM
Hey Danielle,
Your company field is of what type??