- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2017 08:29 AM
Hi All,
I have two fields on the form "Category" and "Subcategory". Subcategory is dependent on Category field. Here I'm trying to remove the option from the subcategory based on the option selected in the category field. I have onChange Client script as below. It doesn't seem to be working. Can someone help me on this.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var incident_category = g_form.getValue('category');
if(incident_category == 'Proactive'){
g_form.removeOption('subcategory','system generated');
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2017 08:32 AM
I don't understand why you cannot do this by updating the dependent values in the choice list.
System generated should not be depended on Proactive but instead something else.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2017 08:32 AM
I don't understand why you cannot do this by updating the dependent values in the choice list.
System generated should not be depended on Proactive but instead something else.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2017 08:34 AM
When viewing the form you can rightclick on the subcategory field and click show choice list.
Find the label you are looking for as subcategory, I am guessing 'system generated'.
Change the depended value to the correct category it should be associated with.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2017 01:19 AM
Hey Corey,
Thanks for the help!. I couldn't do that with the script. Removing the dependent value from subcategory helped us in fixing it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2017 08:38 AM
Why don't you take the option of clearing all and adding in place of using remove option.
use this code. for clearing and adding the options in subcategory.
/***************/
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue == '') {
return;
}
var submodule = g_form.getValue('u_submodule');
g_form.clearOptions('u_submodule');
if (newValue == 'mod1') {
g_form.addOption('u_submodule', 'm1crm', 'M1-CRM');
g_form.addOption('u_submodule', 'm1edi', 'M1-EDI');
g_form.addOption('u_submodule', 'm1edms', 'M1-Imaging/EDMS');
}
if (newValue == 'mod2') {
g_form.addOption('u_submodule', 'm2claims', 'M2-Claims');
g_form.addOption('u_submodule', 'm2reference', 'M2-Reference');
}
if (isLoading && !g_form.isNewRecord()) {
g_form.setValue('u_submodule', submodule);
}
}
/***************/