Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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);
1 change: 1 addition & 0 deletions Client-Side Components/Client Scripts/Section Visibility
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading