How to Link a PDF Combo Box Selection to a Specific Page
Question details
The user needs to navigate to a specific page within a PDF document automatically when a particular item is selected from a combo box or dropdown field.

- Product
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form or directory where selecting a person's name from a dropdown automatically jumps to their biography page.
- Observed behavior
- The user requires a custom JavaScript snippet to map specific dropdown values to the corresponding target pages.
Ensure your PDF editor supports JavaScript execution for form fields. Map out the exact target page numbers for each dropdown selection, and remember that JavaScript uses zero-based indexing for pages.
Use Custom Validation Script in Combo Box Properties
Add a JavaScript code snippet to the dropdown field's custom validation settings to trigger navigation immediately upon selection.
You can create detailed document navigation by scripting the validation events of form fields. The most straightforward method is assigning a target page index to the document's pageNum property based on the selected dropdown value.
Enter form editing mode in your PDF editor, right-click the target Combo Box (dropdown) field, and select 'Properties' from the context menu.
In the Properties dialog box, click on the 'Validate' tab to access the field's scripting and validation options.
Select the radio button for 'Run custom validation script', then click the 'Edit' button to open the JavaScript editor.
Input your conditional JavaScript. For example: if (event.value == 'Larry Boo') this.pageNum = 25; else if (event.value == 'Mo') this.pageNum = 28;. Click 'OK' to save the script.
Exit form editing mode and select an item from the combo box to ensure the document instantly navigates to the correct page.

Create and Manage PDF Forms with WPS Office
WPS Office provides a comprehensive PDF editor that allows you to easily manage interactive forms, edit text, and organize pages without needing complex or expensive software.
- 1. Open WPS Office: Launch WPS Office and open your PDF document using the built-in WPS PDF tool.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access various form controls, including text fields, checkboxes, and combo boxes.
- 3. Edit Properties: Double-click any form field to open its properties, where you can adjust its appearance, predefined options, and interactive settings.

Frequently Asked Questions
Why does my dropdown script navigate to the wrong page?
PDF JavaScript uses zero-based indexing. If your script specifies this.pageNum = 5, it will actually navigate to the 6th page of the document. Always subtract 1 from your target page number when writing the script.
Where exactly do I place the JavaScript code in the combo box settings?
The code should be placed in the 'Custom Validate Script' area under the 'Validate' tab of the Combo Box Properties. Using the validation event ensures the navigation triggers immediately when a new value is selected.
Can I use a combo box selection to open an external website instead of a page?
Yes. Instead of setting this.pageNum, you can use the app.launchURL('https://example.com') method in your conditional JavaScript to open a specific website based on the dropdown selection.
Do these custom navigation scripts work on mobile PDF viewers?
Support for custom PDF JavaScript varies by application. While it works reliably on robust desktop programs like Adobe Acrobat or dedicated PDF editors, many default mobile PDF viewers or web browsers do not support advanced JavaScript execution.




