Get the Active Checkbox Field Name with Acrobat JavaScript
Question details
Identify the checkbox field that triggered a mouse-up event without looping through every PDF form field.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form author is writing an Acrobat JavaScript action for a checkbox field.
- Observed behavior
- The script needs the triggering field's name so it can test that name directly.
Open the PDF in Adobe Acrobat and make sure you can edit its form fields. Check the checkbox's field name in its properties if you plan to compare it with a specific name.
Read the triggering checkbox name from the event target
Use this method in a checkbox's Mouse Up JavaScript action to get its field name directly.
In Acrobat, open Prepare a Form, select the checkbox, and open its Properties.
On the Actions tab, choose Mouse Up as the trigger and Run a JavaScript as the action, then select Add.
In the JavaScript editor, enter `var strFldName = event.target.name;`. To test for an exact field name, add `if (strFldName === "text-12") { /* your action */ }`.
Close the properties, save the PDF, and click the checkbox to run its Mouse Up action.

Work with PDF and Office files in WPS Office
WPS Office is a free, lightweight alternative for everyday PDF and Office work, with a familiar interface and compatible file formats for easier migration. It does not replace Acrobat's checkbox event JavaScript workflow.

Frequently Asked Questions
How do I get the checkbox field name in Acrobat JavaScript?
In the checkbox's Mouse Up JavaScript action, use `event.target.name`. It returns the name of the field that triggered the event.
Do I need to loop through all PDF fields?
No. Within the checkbox's event action, `event.target.name` identifies the triggering field directly.
How can I check for one exact field name?
Compare the name directly, for example: `if (event.target.name === "text-12") { /* your action */ }`.
Where do I add the Mouse Up script in Acrobat?
Open Prepare a Form, open the checkbox's Properties, and use the Actions tab to add a Run a JavaScript action with Mouse Up as the trigger.




