hi guys
I need a server side script to prevent users from typing special chars in the summary field ,only alphanumeric are allowed
On the summary field server-side script, add the following:
def summaryFld = getFieldById(fieldChanged)
def specialMatcher = summaryFld.value =~ /[^\w\s]/
summaryFld.clearError()
if(specialMatcher){
summaryFld.setError("Specials characters are not allowed: ${specialMatcher.collect().unique().join(' ')}")
}
If you want to allow certain punctuation marks and other characters, you can add them inside the square brackets like:
def specialMatcher = summaryFld.value =~ /[^\w\s.,!'"-]/
\w means all "word" characters such as a-z and 0-9 (also includes _)
\s means any whitespace characters (such as space, tabs and newlines)
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.