Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Edit pattern for text fields

Avatar

Former Community Member
I have a number of text fields for which I want to restrict input to alpha characters only (including hyphen, apostrophe, period and space). I want to disallow numeric and special characters. I want to require a minimum length and a maximum.



I tried using an edit pattern of "AAAAAAAAAA" for the field but a user can enter digits also and they are not rejected.



I am creating an Acrobat 7-compatible PDF form using Designer 8.



Thanks for any help... Patrick McManus
1 Reply

Avatar

Level 6
Hi Patrick,



I don't know if this can be done using a format validation, but you can do it in script. Put this in your script for the validate event. It will strip out any characters that don't fit your criteria, then check that the result has between 5 and 10 characters.



valFormat();



function valFormat() {

var rExp = /[^a-zA-Z\-\'\. ]/g;

this.rawValue = this.rawValue.replace(rExp, "");

return ((this.rawValue.length > 4) && (this.rawValue.length < 11))

}



Hope this helps.



Jared Langdon

www.jlangdon.ca