Appian Community and Appian Academy are being upgraded. As a part of the upgrade, Appian Community is currently in read-only mode, and user registration is disabled until August 3. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!
The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.
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.