Dependent choice values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
I have Field 2 dependent on Field 1.
Field 1:
A
B
C
D
Field 2:
Unknown
None
Empty
Populated
Can I have a choice on Field 2 show if any of the choices from Field 1 are selected? For example, I want Unknown to show if any of the choices are selected in Field 1. Or, I want Unknown to show if A, B or C is selected in Field 1.
Can please provide a client script for this it is helpful. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @vinod6,
you can make the choice field dependent on another choice field. You can check out the OOTB example for incident.subcategory.
In the choice values set the "Dependent value" accordingly for the choice values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
you can use onchange Clientscript of Field 1
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) return;
g_form.clearOptions('field_2');
// Show "Unknown" only for A, B, or C
if (newValue == 'A' || newValue == 'B' || newValue == 'C') {
g_form.addOption('field_2', 'unknown', 'Unknown');
}
// Add other options normally
g_form.addOption('field_2', 'none', 'None');
g_form.addOption('field_2', 'empty', 'Empty');
g_form.addOption('field_2', 'populated', 'Populated');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @vinod6 ,
You can take a reference from category and subcategory field in incident form
Subcategory is dependent on category so if we select any category subcategory field will show that options only
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
55m ago - last edited 48m ago
Hi @vinod6
Similar to Incident form category/subcategory fields config, I created two fields here: Field-1 and Field-2
Then to the dictionary of Field-1 , under choices Field-1 set like this:
Now go to dictionary of Field-2 and make it dependent on Field-1 as shown below:
Configure choices for field-2 as shown, you can tweak as per your use case further
Here is the result for above configuration:
If you find this answer useful, mark it as solution accepted/helpful
Thanks and Regards,
Mohammed Zakir
