Hello,
Is there a method to restrict the use of special characters other than "space, (), [], and <>" in the text field or paragraph field?
Kind of thinking using validation.
Thank you.
Discussion posts and replies are publicly visible
You have to use regex to restrict it.
There are many ways of doing it One of the methods that I use the most is to see Stripwith() function to remove all the special characters and then compare the length of the two strings. Also, isolate this in a rule so you can add or remove characters in the future with ease.
You can try this :
a!localVariables( local!allspecialCharacters: "`!@#$%^&*-_={}|\/:;'"",.?", local!textField: "", a!textField( label: "Text", labelPosition: "ABOVE", value: local!textField, saveInto: { local!textField }, refreshAfter: "UNFOCUS", validations: { if( len(local!textField) = 0, null, if( len(local!textField) > len( stripwith( local!textField, local!allspecialCharacters ) ), "Special Characters not allowed", null ) ) } ))
I kind of made it like
a!isNullOrEmpty( concat( a!forEach( items: { "`","~","!","@","#","$","%","^","&","*","_","-","=","/","?","{","}",";",":" }, expression: { if( search(fv!item, ri!textField, 1) = 0, {}, 1 ) } ), ) )
but, think yours is better.