PDF Editing Issues

How to Validate Numbers or Text in Acrobat PDF Form Fields

Natalie TaylorNatalie Taylor Nov 3, 2026 869 views

Question details

The user needs to configure a PDF form field to accept either whole numbers with comma separators or specific text abbreviations (such as TBD or BTS).

How to Validate Numbers or Text Options in an Acrobat Form Field
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating an interactive PDF form where a specific field requires a mixed-type data entry of either formatted numeric values or predetermined text strings.
Observed behavior
Standard number formatting natively restricts the input to numbers only, automatically rejecting necessary text values like 'TBD' or 'BTS'.
Before you start

Ensure you have access to the PDF form editing tools and JavaScript console in your PDF editor before attempting to apply custom validation scripts.

Solution 1Recommended

Use a Custom JavaScript Validation Script

A custom validation script allows you to define exactly which data formats (numbers or specific strings) are acceptable, overriding default restrictions.

Because standard PDF number formatting does not allow text input, you must use a custom validation script. By applying a Regular Expression (Regex), you can program the field to accept either a whole number with comma separators or specific text abbreviations, rejecting all other unexpected input.

1
Enter Prepare Form mode

Open your PDF in Acrobat, go to the 'Tools' menu, and select 'Prepare Form' to enable form editing.

2
Access field properties

Right-click the target form field and select 'Properties' from the context menu.

3
Apply custom validation

Navigate to the 'Validate' tab, select the option 'Run custom validation script', and click the 'Edit' button.

4
Enter the Regex script

Paste the following script into the editor: event.rc = /^(?:\d{1,3}(?:,\d{3})*|TBD|BTS)$/.test(event.valueAsString); then click 'OK'.

5
Save and test

Close the properties window, exit form editing mode, and test the field by typing a formatted number or 'TBD'.

Use a Custom JavaScript Validation Script
Automatic Formatting: If you need commas to be inserted automatically as the user types, you will also need to add a custom formatting script in the 'Format' tab.
Powerful PDF Form Editor

Create and Validate PDF Forms with WPS Office

WPS Office provides a comprehensive suite of PDF tools, allowing you to easily create interactive forms, add text fields, and configure data validation without complex setups.

  1. 1. Open your PDF: Launch WPS Office and open your PDF document.
  2. 2. Access the Form tools: Navigate to the 'Form' tab on the top ribbon to access interactive form features.
  3. 3. Insert a Text Field: Select 'Text Field' and click anywhere on your document to place the field.
  4. 4. Configure properties: Double-click the newly created field to open its Properties dialog and configure your validation rules.
Supports adding, editing, and validating interactive PDF form fields.Highly compatible with Microsoft Office formats and standard Adobe Acrobat PDF files.Lightweight, user-friendly interface for seamless document management.Free tools for reading, annotating, and filling out PDF forms.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my PDF form field reject text when set to a number format?

When a field is formatted as a number in PDF form properties, the software automatically applies a built-in validation rule that strictly rejects any non-numeric characters, preventing the input of text like 'TBD'.

What is the difference between a validation script and a keystroke script?

A validation script checks the entire value after the user finishes typing and attempts to leave the field. A keystroke script evaluates each character immediately as it is typed, blocking invalid keys instantly.

Can I automatically add commas to numbers without using JavaScript?

Yes, standard number formatting allows for automatic comma separators. However, if you also need the same field to accept specific text options, default settings cannot be used, and you must rely on custom format and validation scripts instead.

Does WPS Office support editing PDF form fields?

Yes, WPS Office offers robust PDF tools that allow users to create, edit, fill, and manage interactive PDF forms effortlessly.