PDF Editing Issues

Clear Invalid PDF Form Entries in Adobe Acrobat

Emma BrownEmma Brown Nov 19, 2026 868 views

Question details

Configure a PDF form field to notify users and clear blank or prohibited entries without unnecessarily locking the form.

Clear Invalid PDF Form Entries in Adobe Acrobat
Product
Adobe Acrobat Pro PDF forms
Device & OS
not provided
Scenario
A form creator wants a name field to reject blank values and entries such as n/a, self, or none.
Observed behavior
Invalid entries should be cleared with a helpful message while users remain free to save or close the document.
Before you start

Open the PDF in Adobe Acrobat Pro and confirm that the field is an editable text field. Check its exact field name in Prepare a Form, since the script must reference that name.

Solution 1Recommended

Clear prohibited entries when the user leaves the field

Use an On Blur action to clear invalid text and alert the user without forcing focus back into the field.

This example checks a text field named Full Name. It treats blank entries and the exact values n/a, self, and none as invalid, regardless of capitalization or surrounding spaces.

1
Open the field properties

In Adobe Acrobat Pro, open the PDF and select All tools > Prepare a form. Double-click the name field to open Properties, and confirm its name on the General tab.

2
Add an On Blur action

Open the Actions tab, choose On Blur as the trigger and Run a JavaScript as the action, then select Add.

3
Enter the validation script

In the JavaScript editor, enter the following script, replacing Full Name with the exact field name if needed: var field = this.getField("Full Name"); var value = String(field.value).replace(/^\s+|\s+$/g, ""); if (value === "" || /^(n\/a|self|none)$/i.test(value)) { field.value = ""; app.alert("Please enter a valid name."); }

4
Mark the field as required

On the General tab of the field properties, select Required if the form uses a submission workflow. Close Properties and save the PDF.

5
Test the form

Use Preview in Prepare a form to enter n/a, self, none, and a valid name. Leave the field after each entry and verify that invalid values are cleared and valid values remain.

Clear prohibited entries when the user leaves the field
Check the viewer and submission workflow: PDF JavaScript and required-field checks may behave differently across viewers. Test the form in the viewer recipients will use. Marking a field Required typically affects form submission, not ordinary saving or closing.
Free Microsoft Office alternative

Work with PDF forms and Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. It supports common Microsoft Office formats for an easy move between applications, but it does not fix or replace Acrobat's PDF JavaScript validation.

Open and work with PDF documents and formsCompatible with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXUse a familiar interface for everyday document tasksMove between common Office files without changing your workflow
microsoft office alternative - wps office

Frequently Asked Questions

Does setting event.rc to false clear a PDF form field?

In an Acrobat Validate action, event.rc = false rejects the proposed value and generally restores the previous value; it does not necessarily leave the field empty. Use an On Blur action that assigns an empty string if clearing is the goal.

Can users still save or close the PDF if the name is invalid?

The On Blur script clears the invalid entry and shows an alert without explicitly returning focus to the field. After dismissing the alert, users can generally save or close the PDF; test this in their intended viewer.

Will the Required setting stop someone from saving an incomplete form?

Not generally. In Acrobat, the Required field property is primarily checked during form submission. It should not be relied on to block an ordinary save or close.

Why does the validation script not run in every PDF viewer?

Some PDF viewers do not support Acrobat JavaScript or have it disabled. Test the form in the recipient's viewer and check its JavaScript settings before distributing the PDF.