PDF Editing Issues

How to Allow Only Alphabetic Characters in an Acrobat Form Field

Jason MillerJason Miller Nov 3, 2026 869 views

Question details

The user wants to configure a PDF form field to accept only letters (alphabetic characters) while automatically rejecting numbers and special characters.

How to Allow Only Alphabetic Characters in an Acrobat Form Field
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating or formatting an interactive PDF form where specific text fields must strictly contain alphabetical inputs, such as a First Name or Last Name field.
Observed behavior
By default, PDF text fields accept all characters. The user needs to enforce an alphabetical-only input restriction using a custom JavaScript keystroke script.
Before you start

Ensure your PDF editor supports JavaScript for form fields (such as Adobe Acrobat Pro) and that your document is opened in form preparation mode.

Solution 1Recommended

Apply a Custom Keystroke Script to the Form Field

Use Adobe Acrobat's built-in custom format settings to add a JavaScript keystroke script that validates inputs in real-time.

By utilizing a custom keystroke script, you can intercept the characters typed by the user. The script uses a regular expression to test if the character is a letter. If the character is a number or symbol, the script rejects the input instantly.

1
Enter Prepare Form Mode

Open your PDF document in Adobe Acrobat. Go to 'Tools' and select 'Prepare Form' to enable form editing.

2
Open Field Properties

Right-click the specific text field you want to restrict and select 'Properties' from the context menu.

3
Navigate to the Format Tab

In the Properties dialog box, click on the 'Format' tab located at the top.

4
Select Custom Format Category

Click the 'Select format category' drop-down menu and choose 'Custom'.

5
Enter the Keystroke Script

In the 'Custom Keystroke Script' box, click 'Edit' and paste the following script exactly: if (event.value) event.rc = /^[a-z]*$/i.test(event.change); Click 'OK' to save.

6
Test the Form Field

Close the Properties dialog and click 'Preview' at the top right. Try typing numbers and letters into the field to ensure only alphabetic characters are accepted.

Apply a Custom Keystroke Script to the Form Field
Script Explanation: The expression /^[a-z]*$/i ensures that the character being typed (event.change) is an uppercase or lowercase letter. If it is not, event.rc evaluates to false, blocking the keystroke.
Powerful PDF Form Editor

Create and Edit PDF Forms Seamlessly with WPS PDF

While advanced JavaScript validations require specific configurations, WPS Office provides a comprehensive and highly compatible PDF editor for creating, editing, and filling interactive PDF forms effortlessly.

  1. 1. Download and Install: Download WPS Office Free and install it on your device.
  2. 2. Open the PDF File: Launch WPS PDF and open your existing PDF document.
  3. 3. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to view form editing options.
  4. 4. Edit Form Fields: Select 'Text Field' to insert a new field or click an existing field to modify its properties.
  5. 5. Save the Document: Once your form fields are configured, save your fillable PDF document securely.
Easily create, fill, and manage interactive PDF formsHighly compatible with Adobe Acrobat PDF formatsLightweight application with an intuitive, user-friendly interfaceOffers extensive PDF editing tools including text, image, and page manipulation
microsoft office alternative - wps office

Frequently Asked Questions

Can I restrict a PDF form field to accept only numbers?

Yes. In the form field properties, you can navigate to the 'Format' tab and select 'Number' from the format category drop-down. Alternatively, you can use a similar custom keystroke script designed specifically for numeric inputs.

Will JavaScript form validations work on all PDF readers?

Custom keystroke scripts work perfectly on robust desktop PDF readers like Adobe Acrobat and advanced PDF editors. However, some basic web browsers or mobile PDF viewers might not fully support JavaScript execution, potentially allowing users to bypass the restriction.

How do I apply the alphabetical restriction to multiple fields simultaneously?

While in form editing mode, you can hold the Ctrl (or Cmd) key to select multiple text fields. Right-click any of the selected fields, open 'Properties', and apply the custom keystroke script in the 'Format' tab once to update all selected fields at the same time.