How to Fix If-Then Comparison Scripts in Acrobat PDF Forms
Question details
The user needs to correct a JavaScript conditional statement in an Acrobat PDF form that evaluates incorrectly.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating or editing an interactive PDF form with custom validation scripts.
- Observed behavior
- The form script always returns 'Valid' regardless of input because it uses an assignment operator (=) instead of a comparison operator (==).
Before editing your form scripts, ensure you have a backup copy of your PDF file in case you need to revert any JavaScript changes.
Correct the JavaScript Equality Operator and Case Sensitivity
Replace the assignment operator with the equality operator and ensure standard JavaScript casing conventions are followed.
In JavaScript, a single equals sign (=) assigns a value, while a double equals sign (==) compares two values. Using a single equals sign in an 'if' statement will force the condition to evaluate as true, causing incorrect form validation.
Additionally, JavaScript is strictly case-sensitive. Built-in objects like 'event' must be written in lowercase to be recognized properly by the Acrobat JavaScript engine.
Open your PDF form in Adobe Acrobat and enter 'Prepare Form' mode from the tools menu.
Right-click the specific form field containing the validation script and select 'Properties'.
Navigate to the 'Calculate' or 'Validate' tab where your custom JavaScript is located and click 'Edit'.
Locate the conditional if statement. Change the single '=' to '==' to ensure the script compares the values rather than assigning them.
Check for case-sensitive syntax errors. Ensure 'Event.value' or any capitalized instances are corrected to the lowercase 'event.value'.
Click 'OK' to save the updated script. Exit the form editing mode to preview and test the form fields, ensuring the validation now works correctly.

Manage and Edit PDF Documents Easily with WPS Office
While complex custom JavaScript logic might require dedicated Adobe tools, you can handle everyday PDF reading, form filling, and document conversions quickly and seamlessly using WPS Office. It is a comprehensive, lightweight suite that serves as a perfect free alternative to traditional Office software.
- 1. Download the software: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Open your documents: Launch WPS Office and easily open your existing PDFs, Word documents, Excel sheets, and PowerPoint files without losing formatting.
- 3. Edit and save: Use the built-in PDF tools to fill standard forms, annotate, or read documents, then save your changes securely.

Frequently Asked Questions
Why does my PDF form script always evaluate to true?
This usually happens when an assignment operator (=) is used instead of an equality operator (==) in the conditional statement. The single equals sign assigns the value and evaluates as true, bypassing the intended comparison.
Is JavaScript in Acrobat PDF forms case-sensitive?
Yes, JavaScript is strictly case-sensitive. Keywords, object names like 'event', and function calls must be written with the exact casing required by the language standards.
Can I edit PDF form scripts in free PDF readers?
No, standard free PDF readers only allow you to view documents and fill out basic forms. To add or edit custom JavaScript validation scripts, you need advanced PDF authoring software.
What is the difference between == and === in JavaScript?
The double equals (==) compares values for equality after performing type conversion if necessary. The triple equals (===) checks for strict equality, meaning it checks both the value and the data type without converting them.




