Skip to content

Commit eaaf13f

Browse files
author
SWETHA R
authored
Updated setColor.js
1 parent 9a8fe4f commit eaaf13f

File tree

1 file changed

+7
-3
lines changed
  • Client-Side Components/Client Scripts/Color-coded Priority field for improved UX

1 file changed

+7
-3
lines changed
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
function onChange(control, oldValue, newValue, isLoading) {
2+
if (isLoading) return; // Skip when loading the form
23

4+
// Map backend choice values to colors
35
var colorMap = {
46
'1': '#e74c3c', // Critical - strong red
57
'2': '#e67e22', // High - bright orange
@@ -8,8 +10,10 @@ function onChange(control, oldValue, newValue, isLoading) {
810
'5': '#27ae60' // Planning - green
911
};
1012

11-
var priorityField = g_form.getControl('priority');
12-
if (!priorityField) return;
13+
// Replace 'priority' with your field name
14+
var fieldControl = g_form.getControl('priority');
15+
if (!fieldControl) return;
1316

14-
priorityField.style.backgroundColor = colorMap[newValue] || '';
17+
// Apply background color based on selected value
18+
fieldControl.style.backgroundColor = colorMap[newValue] || '';
1519
}

0 commit comments

Comments
 (0)