- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2017 07:30 AM
Hi Guys,
We have a requirement for a catalog item variable, in which it should restrict the
below special characters.
"(&[]~@|$^<>\*+=;?`')" ---> inside quotes
I have written the below on change client script to achive this. The script is working
for all specail characters except for "\". Please provide your valuable inputs
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
// Dissallow special characters in application long name
var specialCharRegex = /[~@|$&^<>\*+=;?`'())[\]]/;
if(specialCharRegex.test(newValue)){
alert('special characters are not allowed');
g_form.setValue('app_long_name','');
}
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2017 07:38 AM
Did you try var specialCharRegex = /[~@|$&^<>\\*+=;?`'())[\]]/;
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2017 07:38 AM
Did you try var specialCharRegex = /[~@|$&^<>\\*+=;?`'())[\]]/;
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2017 07:51 AM
It worked... Thanks!!!!!!!
such a rookie mistake..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2017 07:44 AM
Your regex need to be : [~@|$&^<>\*+=;?`'())[\]\\]
var specialCharRegex = /[~@|$&^<>\*+=;?`'())[\]\\]/;