From 2d6bf225e62705eba073e0a3068dc92ed0fb0b7a Mon Sep 17 00:00:00 2001 From: SURAJ NIKAM <85665236+surajnikam111@users.noreply.github.com> Date: Mon, 13 Oct 2025 16:13:03 +0530 Subject: [PATCH 1/2] Create Section Visibility To hide sections based on state --- Client-Side Components/Client Scripts/Section Visibility | 1 + 1 file changed, 1 insertion(+) create mode 100644 Client-Side Components/Client Scripts/Section Visibility diff --git a/Client-Side Components/Client Scripts/Section Visibility b/Client-Side Components/Client Scripts/Section Visibility new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/Client-Side Components/Client Scripts/Section Visibility @@ -0,0 +1 @@ + From 178a3fcd3eddd16db8de51e50fd81cddd8a7697f Mon Sep 17 00:00:00 2001 From: SURAJ NIKAM <85665236+surajnikam111@users.noreply.github.com> Date: Mon, 13 Oct 2025 16:22:32 +0530 Subject: [PATCH 2/2] Update autoPopulateSD.js 1) Variable names are shorter and clearer (category, currentShortDesc). 2) Used direct key access (prefixMap[category]) instead of hasOwnProperty. 3) Removed unnecessary comments (code is self-explanatory now). --- .../autoPopulateSD.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Client-Side Components/Client Scripts/Auto-Populate Short Discription/autoPopulateSD.js b/Client-Side Components/Client Scripts/Auto-Populate Short Discription/autoPopulateSD.js index 86e278e3bc..606dc5a7ae 100644 --- a/Client-Side Components/Client Scripts/Auto-Populate Short Discription/autoPopulateSD.js +++ b/Client-Side Components/Client Scripts/Auto-Populate Short Discription/autoPopulateSD.js @@ -1,23 +1,17 @@ // Client Script to Auto-Populate Short Description based on Category function onChangeCategory() { - var categoryField = g_form.getValue('category'); // Get the selected category - var shortDescriptionField = g_form.getValue('short_description'); // Get the Short Description field + var category = g_form.getValue('category'); + var currentShortDesc = g_form.getValue('short_description'); - // Define mappings for categories and corresponding short descriptions - var categoryToShortDescription = { + var prefixMap = { 'Hardware': 'Hardware Issue - ', 'Software': 'Software Issue - ', 'Network': 'Network Issue - ', 'Other': 'Other Issue - ' }; - // Update Short Description based on the selected category - if (categoryToShortDescription.hasOwnProperty(categoryField)) { - var newShortDescription = categoryToShortDescription[categoryField] + shortDescriptionField; - g_form.setValue('short_description', newShortDescription); + if (prefixMap[category]) { + g_form.setValue('short_description', prefixMap[category] + currentShortDesc); } } - -// Attach the onChangeCategory function to the 'category' field -g_form.observe('change', 'category', onChangeCategory);