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
@@ -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.
Original file line number Diff line number Diff line change
@@ -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
}
Loading