Use Acrobat JavaScript to Navigate PDF Pages with Radio Buttons
Question details
Require one selection from each of two radio button groups and navigate to a PDF page based on the selected combination.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- An interactive PDF uses two radio button groups and a navigation button to direct readers to different pages.
- Observed behavior
- The navigation button should check both selections and open the page associated with their combination.
In Acrobat's Prepare a Form tool, check the exact field name for each radio button group and the export value for each choice. Identify the destination pages and confirm JavaScript is enabled in the PDF viewer used for testing.
Add a Mouse Up JavaScript action to the navigation button
Use this method to validate both radio groups and route the reader to a page for each supported combination.
The example uses Group1 and Group2 as field names and Option1 and Option2 as export values. Replace them with the names and values in your form.
Acrobat page indexes start at zero: 0 opens page 1, and 1 opens page 2. Set each destination index to an existing page in your PDF.
In Acrobat, open the PDF and select All tools > Prepare a form. Check the radio groups' field names and each choice's export value in its properties.
Select the navigation button, open Properties, and go to Actions. Choose Mouse Up as the trigger and Run a JavaScript as the action, then select Add.
In the JavaScript editor, enter the following script. Replace the field names, export values, and page indexes with those for your form; add or change conditions for other combinations: var group1 = this.getField("Group1"); var group2 = this.getField("Group2"); if (!group1 || !group2) { app.alert("A radio button group was not found. Check the field names."); } else { var choice1 = group1.valueAsString; var choice2 = group2.valueAsString; if (!choice1 || choice1 === "Off" || !choice2 || choice2 === "Off") { app.alert("Please select one option from each group."); } else if (choice1 === "Option1" && choice2 === "Option1") { this.pageNum = 0; } else if (choice1 === "Option1" && choice2 === "Option2") { this.pageNum = 1; } else if (choice1 === "Option2" && choice2 === "Option1") { this.pageNum = 2; } else if (choice1 === "Option2" && choice2 === "Option2") { this.pageNum = 3; } else { app.alert("No destination is configured for this combination."); } }
Save the PDF, exit Prepare a Form, and click the navigation button with no selections, one selection, and each supported combination. Confirm that each combination opens its intended page.

Work with PDF and Office documents in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface and support for common document formats, making it easy to bring existing files into your workflow. Use Acrobat to configure and test the JavaScript navigation described above; WPS does not fix Acrobat scripting behavior.

Frequently Asked Questions
How do I find a radio button's export value?
In Acrobat, open All tools > Prepare a form, select the radio button, and open Properties. Check the choice or export value on the Options tab and use that exact value in the script.
Why does the script open page 1 when I use page number 0?
Acrobat's JavaScript page indexes are zero-based. Set this.pageNum to 0 for page 1, 1 for page 2, and so on.
What happens if a reader leaves a radio group unselected?
The example checks for an empty value or Off and displays an alert instead of navigating. Test this by clicking the navigation button before selecting both groups.
Why doesn't the navigation button work in my browser?
Some browser PDF viewers do not support Acrobat JavaScript. Open the PDF in Acrobat or Acrobat Reader, check that JavaScript is enabled in its preferences, and test the button again.




