Skip to content

Commit 0f50098

Browse files
authored
Create mandatory_subcategory.js
1 parent a6d1a65 commit 0f50098

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Type: onChange
2+
// Table: incident
3+
// Field: category
4+
function onChange(control, oldValue, newValue, isLoading) {
5+
if (isLoading || newValue == '') {
6+
return;
7+
}
8+
9+
// Make subcategory mandatory when category is selected
10+
if (newValue=="<category_name>") {
11+
g_form.setMandatory('subcategory', true);
12+
g_form.showFieldMsg('subcategory', 'Please select a subcategory', 'info');
13+
} else {
14+
g_form.setMandatory('subcategory', false);
15+
g_form.hideFieldMsg('subcategory');
16+
}
17+
}

0 commit comments

Comments
 (0)