PDF Editing Issues

Compare Form Fields with Control Data in Adobe Acrobat

Olivia MillerOlivia Miller Nov 19, 2026 868 views

Question details

Compare values entered in a fillable PDF with predefined control data and warn the user about mismatches.

Compare Form Fields with Control Data in Adobe Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A form author wants to validate text fields, date fields, and radio-button selections against expected values.
Observed behavior
The form should identify values that differ from the control data and display a warning.
Before you start

Open the PDF in Acrobat and use Prepare a Form to check the exact field names, date format, and radio-button export values. Make sure JavaScript is enabled in the PDF viewer you will use for testing.

Solution 1Recommended

Compare Form Values with an Acrobat JavaScript Action

Use a button action to check multiple fields at once and show a summary of mismatches.

The example compares the displayed field values as text. Set the expected date to match the field's date format, and use the selected radio button's export value rather than its visible label.

1
Check the form fields

In Acrobat, open All tools > Prepare a form. Note each field name, configure the date field's format, and check the radio-button export values in its Properties.

2
Add a validation button

In Prepare a Form, add a button and open its Properties. On the Actions tab, select the Mouse Up trigger and Run a JavaScript action, then click Add.

3
Enter the comparison script

Paste the following script into the JavaScript editor. Replace the example field names and expected values with your own: var expected = { "CustomerName": "Jane Doe", "OrderDate": "01/31/2026", "DeliveryChoice": "Standard" }; var issues = []; for (var name in expected) { if (expected.hasOwnProperty(name)) { var field = this.getField(name); if (!field) { issues.push(name + ": field not found"); } else if (field.valueAsString !== expected[name]) { issues.push(name + ": value does not match"); } } } if (issues.length > 0) { app.alert("Please check these fields:\n" + issues.join("\n")); }

4
Save and test the form

Save the PDF, enter matching and nonmatching values, and click the validation button. Test it in the intended PDF viewer to confirm that its JavaScript support and settings allow the alert to run.

Compare Form Values with an Acrobat JavaScript Action
Do not use this as a security check: Control values stored in PDF JavaScript may be visible to users, and client-side validation can be bypassed. Verify sensitive or authoritative data on a trusted server instead.
Free Microsoft Office alternative

Work with PDF and Office Files in WPS Office

WPS Office is a free, lightweight Office alternative with a familiar interface and support for common Office formats, making it easier to move existing documents into your workflow. It does not replace Acrobat for authoring or validating Acrobat JavaScript form actions.

Open and work with PDF files alongside Office documentsCompatible with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXUse a familiar interface for everyday document tasksMove existing Office files into a lightweight workspace
microsoft office alternative - wps office

Frequently Asked Questions

How do I find a field's name in Acrobat?

Open All tools > Prepare a form, select the field, and open its Properties. Use the field name exactly as shown in the comparison script.

Why does a date fail the comparison even though it looks correct?

The script compares text exactly. Check the date field's Format settings in Prepare a Form and make the expected value match the displayed format, including leading zeros and separators.

What value should I use for a radio-button selection?

Use the selected option's export value, which may differ from its visible label. Check the radio button's Properties in Prepare a Form.

Why doesn't the warning appear in another PDF viewer?

The viewer may not support the Acrobat JavaScript action, or JavaScript may be disabled. Test the saved form in Acrobat or Reader with JavaScript enabled.