From a47a5ec782d3838ef38ebb5d4f448d6a547bdd2b Mon Sep 17 00:00:00 2001 From: Sachin Narayanasamy <132642563+SachinNarayanasamy@users.noreply.github.com> Date: Sun, 19 Oct 2025 23:47:50 +0530 Subject: [PATCH 1/2] Create Readme.md --- .../Validate Short Description/Readme.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Client-Side Components/Client Scripts/Validate Short Description/Readme.md diff --git a/Client-Side Components/Client Scripts/Validate Short Description/Readme.md b/Client-Side Components/Client Scripts/Validate Short Description/Readme.md new file mode 100644 index 0000000000..b26cfcfd3e --- /dev/null +++ b/Client-Side Components/Client Scripts/Validate Short Description/Readme.md @@ -0,0 +1,34 @@ +Client Script – Validate Short Description +Overview + +This client script validates the Short Description field before a record is submitted. It ensures that the field: + +Does not exceed 100 characters. + +Does not contain any special characters (only letters, numbers, and spaces are allowed). + +This helps maintain data quality, consistency, and readability in incident records or any other relevant table. + +How It Works + +On form submission, the script checks the short_description field. + +If the description is too long or contains invalid characters, the submission is blocked. + +An error message is displayed, and the problematic field can be optionally highlighted. + +Configuration + +Navigate to System Definition → Client Scripts. + +Create a new client script. + +Set the following properties: + +Table: Incident (or the target table) + +Type: onSubmit + +Active: Checked + +Paste the following script into the Script field. From df1255d01429e4a5c7a9ea4f226bc7080dcf4b94 Mon Sep 17 00:00:00 2001 From: Sachin Narayanasamy <132642563+SachinNarayanasamy@users.noreply.github.com> Date: Sun, 19 Oct 2025 23:48:31 +0530 Subject: [PATCH 2/2] Create Validate Short Description.js --- .../Validate Short Description.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Client-Side Components/Client Scripts/Validate Short Description/Validate Short Description.js diff --git a/Client-Side Components/Client Scripts/Validate Short Description/Validate Short Description.js b/Client-Side Components/Client Scripts/Validate Short Description/Validate Short Description.js new file mode 100644 index 0000000000..0eda36267d --- /dev/null +++ b/Client-Side Components/Client Scripts/Validate Short Description/Validate Short Description.js @@ -0,0 +1,20 @@ +function onSubmit() { + var shortDescription = g_form.getValue('short_description'); + + // Check for length + if (shortDescription.length > 100) { + alert('Short Description must not be more than 100 characters long.'); + return false; // Prevent form submission + } + + // Check for special characters + var specialCharsRegex = /[^a-zA-Z0-9\s]/g; + var specialChars = shortDescription.match(specialCharsRegex); + + if (specialChars) { + alert('Short Description contains invalid characters: ' + specialChars.join(', ')); + return false; // Prevent form submission + } + + return true; // Allow submission if both checks pass +}