Disable/ remove choice list options on the form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2017 04:42 AM
Hi can anyone help me out on how can we either disable/removing the choice list options on the form.
I tried couple of things which did not work fully..
Scenario: I have a cat(1,2) and subcat(1- subcat1, 2- subcat2, subcat3) where subcat values are dependent on cat values. I need one of my subcat value(subcat3) to be removed/disabled based on cat value(2). I have used removeOption and disableOption both seems to be working on load.. but when I change the values and reset again it shows the entire list.
Can you please share your valuable suggestions.
Thank You.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2017 05:38 AM
Yes I was a onChange client script. I have already set the dependent values but in some scenarios i need the subcat to be hidden/disabled..
As per the above code.. When I am changing my cat to Unknown - I don't want one the subcat value to be visible.. for selection.
It is working perfectly onload... if your cat is 'unknown' it just removes the required choice but when i change script is invoked onchange of cat and clears the options and again set it back to dependent values..
Hope you understand the problem i am facing here..

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2017 05:47 AM
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue=='')
{
g_form.removeOption('u_sub_category', 'riskrjct');
}
if(newValue == 'unknowns') {
//g_form.clearOptions('u_sub_category');
//g_form.removeOption('u_sub_category', 'riskrjct');
g_form.addOption('u_sub_category', 'riskacpt', 'Unknown Risk Acceptance');
}
//Type appropriate comment here, and begin script below
}
when do you want to clear the option?
Can you please elaborate your requirement. when you want to add the option and when do you want to clear the option?
Thanks,
Harshvardhan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2017 06:09 AM
I have the below list in place..
category - Subcategroy
Defect - Known Issue
Unknown - Unknown Risk Acceptance, Risk Rejected.
Whereas Risk Rejected to be hidden and that would be system generated via script on some condition. So, Users should not be able to view Risk Rejected choice until it is populated via script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2017 07:03 AM
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
g_form.removeOption('u_subcat','risk');
}
var abc=g_form.getValue('u_cat');
// alert(abc);
if(abc=='defect' && abc !='unknown')
{
g_form.addOption('u_subcat','knownissue','known issue');
g_form.removeOption('u_subcat','unknown');
}
if(abc!='defect' && abc =='unknown')
{
g_form.addOption('u_subcat','unknown','Unknown Risk Acceptance');
g_form.removeOption('u_subcat','knownissue');
}
//Type appropriate comment here, and begin script below
}
I have tested the above script and it's working.
Let me know if you have any further question.
Thanks,
Harshvardhan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2017 10:19 PM
Hi Harsha,
Greetings for the Day!
Thanks for your time... it will work only if subcategory is not dependent on category. In my case i have the dependent values set and the list is very big not.. only two. this is an example i am trying to achieve the expected result.
Tried removing and disabling the choice but it is working only on load as I told earlier.. when I try to change it.. again system will set the subcategories as per the dependent values.. remove/ disable doesn't work on change ..
Do we have any other way to achieve this...
Thank You.
Usha