Fix Acrobat JavaScript Counter Script Not Working for Form Fields
Question details
The user needs to fix an Acrobat JavaScript form calculation that counts values in field arrays but fails to work on certain scripts.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Using custom JavaScript to count or calculate values across multiple form field arrays for exempt members and plural memberships.
- Observed behavior
- The first calculation script fails to execute or return the correct count, while the second script functions normally.
Before editing your code, open the JavaScript console in your PDF application (Ctrl+J or Cmd+J in Acrobat) to check for any specific syntax errors or undefined field warnings.
Replace Curly Quotation Marks with Straight Quotes
Use this solution when copying and pasting code from word processors, which often auto-format valid straight quotes into invalid typographical curly quotes.
JavaScript syntax requires standard straight quotation marks for defining strings and arrays. If your script uses curly (smart) quotes, the compiler will fail to interpret the array references properly, causing the counter script to stop working.
Right-click the specific PDF form field that contains the script and select 'Properties'. Navigate to the 'Calculate' or 'Action' tab and click 'Edit' to open the JavaScript window.
Scan your code for any array strings or field names enclosed in quotation marks.
Manually delete any curly quotation marks (“ ” or ‘ ’) and replace them with standard straight quotes (" " or ' ').
Click 'OK' to save the script, close the properties window, and test the form calculation to see if the counter works.

Verify Exact Field Names and Existence
Ensures that all field names referenced in your JavaScript array actually exist in the PDF document.
Check Script Placement in Calculation Events
Confirm that the script is assigned to the correct calculation event so it triggers appropriately.
Create and Manage PDF Forms Easily with WPS Office
If you are struggling with complex JavaScript errors in other PDF tools, WPS PDF offers an intuitive interface to easily manage, create, and fill interactive PDF forms without the hassle of deep coding.
- 1. Open WPS PDF: Launch WPS Office and select the PDF module, then open your existing PDF document.
- 2. Navigate to the Form Tab: Click on the 'Form' tab located on the top ribbon to access the interactive form features.
- 3. Edit Form Fields: Use the visual tools to add, adjust, or verify text fields and checkboxes directly on the page.
- 4. Save Your Changes: Click the 'Save' button to securely save your perfectly functioning, compatible PDF form.

Frequently Asked Questions
Why do my JavaScript array strings cause errors in my PDF?
If you copied your script from a word processor, standard straight quotes often get converted to typographical curly quotes. The PDF JavaScript compiler only recognizes straight quotes, so curly quotes will result in syntax errors and stop the script from running.
How do I check for JavaScript errors in Adobe Acrobat?
You can open the JavaScript Debugger Console by pressing Ctrl+J on Windows or Cmd+J on Mac. This console displays runtime warnings, syntax errors, and detailed messages indicating exactly why your form script failed.
Does the placement of my calculation script matter?
Yes. For a field to update automatically when other values change, its custom JavaScript must be placed in the 'Calculate' tab of the Field Properties. Placing it in the 'Actions' tab (like a Mouse Up event) means it will only execute when the user explicitly interacts with that specific field.




