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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.