These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

How to Restrict a Text Field to Allow Only Letters to be Entered?

akesselm
Registered: Jan 14 2011
Posts: 2

Hi, I have several Text Fields in which I only want to allow users to enter letters (no numbers, special characters, etc.). Can someone please let me know what java script I would need to do this or if there is an alternative method?
 
Thanks,
 
Allon

My Product Information:
Acrobat Pro 8.0, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
You can use JavaScript and the RegExp to write a validation script. See Text matching with regular expressions by Thom Parker for more information and links to additional reference material.

George Kaiser

akesselm
Registered: Jan 14 2011
Posts: 2
I looked at topic, and I am still not sure how to write the script (I am unfortunately new to the world of JavaScript). Could you please provide something more concrete of what it might look like?
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
The following JavaScirpt should work for only alphabetical characters

// RegExp for alpha only
var RE_Alpha = /^[A-z]*$/;
// test field value
RE_Alpha.test($.rawValue);


George Kaiser