Fix Mouse Action Scripts Not Working in Acrobat XI Pro Forms
Question details
The user is experiencing inconsistent behavior with mouse action scripts used to show and hide form fields (Q.0 through Q.4) in Acrobat XI Pro, seeking clarification on Acrobat JavaScript syntax.

- Product
- Adobe Acrobat XI Pro
- Device & OS
- not provided
- Scenario
- Creating interactive PDF forms and assigning JavaScript mouse actions to form buttons to toggle field visibility.
- Observed behavior
- Form buttons fail to execute the intended show/hide actions properly due to syntax errors in the 'this.getfield' script call.
Ensure you have a backup copy of your original PDF form before modifying the JavaScript code, as incorrect syntax can disable existing interactive features.
Correct JavaScript Syntax and Case Sensitivity
Fix the case-sensitivity issue in the Acrobat JavaScript method to properly call and manipulate the form fields.
In Acrobat JavaScript, method names are strictly case-sensitive. Using a lowercase 'f' in 'getfield' will cause the script to fail. Furthermore, understanding the context of the 'this' object is crucial. In a form-field action, 'this' generally refers to the current form field, meaning you must use the methods specific to the field object.
Open your PDF in Adobe Acrobat XI Pro, enter 'Prepare Form' mode, and right-click the button with the assigned mouse action to select 'Properties'.
Navigate to the 'Actions' tab, select the 'Run a JavaScript' action from the list of applied actions, and click the 'Edit' button.
Change the incorrect 'this.getfield' syntax to 'this.getField' using a capital 'F'.
Update the script to properly change the target field's display property. For example: this.getField("Q.0").display = display.hidden;
Click 'OK', close the properties dialog, and test the button in preview mode to ensure the targeted fields correctly hide or show.

Edit and Manage PDF Forms Seamlessly with WPS PDF
If you find complex JavaScript debugging tedious, WPS Office provides a highly intuitive interface for creating, editing, and managing interactive PDF forms. It allows you to handle interactive elements efficiently without deep coding knowledge.
- 1. Open the PDF: Launch WPS Office and open your interactive PDF document.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access the interactive editing suite.
- 3. Edit Fields: Use the built-in tools to insert, adjust, or remove interactive form fields like buttons and text boxes.
- 4. Modify Properties: Double-click any field to edit its properties directly through the intuitive settings panel, bypassing the need for manual JavaScript coding.

Frequently Asked Questions
Why does my Acrobat JavaScript work on one button but not another?
This often happens if the field references are incorrect or if you copied a button and Acrobat auto-created self-referencing actions. Double-check that your this.getField("FieldName") parameter matches the exact target field name case-for-case.
What is the correct syntax to make a PDF form field visible?
To make a field visible using Acrobat JavaScript, set its display property to visible using this exact syntax: this.getField("YourFieldName").display = display.visible;
Does WPS PDF support interactive form fields?
Yes, WPS PDF fully supports creating, editing, and filling interactive form fields, providing a user-friendly and highly compatible alternative for managing PDF forms efficiently.




