PDF Editing Issues

Get the Active Checkbox Field Name with Acrobat JavaScript

Tauseeq MagsiTauseeq Magsi Nov 19, 2026 868 views

Question details

Identify the checkbox field that triggered a mouse-up event without looping through every PDF form field.

Get the Active Checkbox Field Name with Acrobat JavaScript
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the checkbox properties

In Acrobat, open Prepare a Form, select the checkbox, and open its Properties.

2
Add a Mouse Up action

On the Actions tab, choose Mouse Up as the trigger and Run a JavaScript as the action, then select Add.

3
Get and test the field name

In the JavaScript editor, enter `var strFldName = event.target.name;`. To test for an exact field name, add `if (strFldName === "text-12") { /* your action */ }`.

4
Save and test

Close the properties, save the PDF, and click the checkbox to run its Mouse Up action.

Read the triggering checkbox name from the event target
About name matching: For an exact name, use equality. A word-boundary expression such as `/\btext-12\b/.test(strFldName)` can also match names containing additional punctuation, so it is not always an exact-name test.
Free Microsoft Office alternative

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.

Open and work with PDF documents alongside Office filesCompatible with Microsoft Word, Excel, and PowerPoint formatsFamiliar interface for a smoother move from Microsoft OfficeFree, lightweight tools for everyday document tasks
microsoft office alternative - wps office

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.