From eaaf13fd50ccbccf1c2f3e060e33706dcab3d91b Mon Sep 17 00:00:00 2001 From: SWETHA R <154652423+Shweyy123@users.noreply.github.com> Date: Mon, 6 Oct 2025 15:00:51 +0530 Subject: [PATCH] Updated setColor.js --- .../setColor.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Client-Side Components/Client Scripts/Color-coded Priority field for improved UX/setColor.js b/Client-Side Components/Client Scripts/Color-coded Priority field for improved UX/setColor.js index 9538d57461..c3079e019c 100644 --- a/Client-Side Components/Client Scripts/Color-coded Priority field for improved UX/setColor.js +++ b/Client-Side Components/Client Scripts/Color-coded Priority field for improved UX/setColor.js @@ -1,5 +1,7 @@ function onChange(control, oldValue, newValue, isLoading) { + if (isLoading) return; // Skip when loading the form + // Map backend choice values to colors var colorMap = { '1': '#e74c3c', // Critical - strong red '2': '#e67e22', // High - bright orange @@ -8,8 +10,10 @@ function onChange(control, oldValue, newValue, isLoading) { '5': '#27ae60' // Planning - green }; - var priorityField = g_form.getControl('priority'); - if (!priorityField) return; + // Replace 'priority' with your field name + var fieldControl = g_form.getControl('priority'); + if (!fieldControl) return; - priorityField.style.backgroundColor = colorMap[newValue] || ''; + // Apply background color based on selected value + fieldControl.style.backgroundColor = colorMap[newValue] || ''; }