Skip to content

Commit 4523c2b

Browse files
authored
Validation (#1584)
* Create validateSpecialChar.js * Create Readme.md
1 parent 271b1d6 commit 4523c2b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Effectively validates the short description field ensuring data quality and preventing invalid input.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Client Script to Validate Special Charecters
2+
function onSubmit() {
3+
var shortDescription = g_form.getValue('short_description');
4+
var specialCharsRegex = /[^a-zA-Z0-9\s]/g;
5+
var specialChars = description.match(specialCharsRegex);
6+
if (specialChars) {
7+
alert('Description contains invalid characters: ' + specialChars.join(', '));
8+
return false;
9+
} else {
10+
return true;
11+
}
12+

0 commit comments

Comments
 (0)