PDF Editing Issues

How to Create a PDF Button That Jumps to a Page Based on a Score

John WilsonJohn Wilson Oct 28, 2026 868 views

Question details

The user needs to set up a PDF form button to automatically navigate to different specific pages depending on a numeric score value entered in a designated text field.

How to Create a PDF Button That Jumps to Pages Based on a Score
Product
PDF Editor
Device & OS
not provided
Scenario
Creating an interactive PDF quiz, assessment, or dynamic form that routes users to customized outcome pages based on their score.
Observed behavior
A single interactive button reads the score field, evaluates which predefined range the score falls into, and jumps to the corresponding zero-based page number using JavaScript logic.
Before you start

Verify the exact name of your score text field (e.g., 'Score') and calculate the zero-based target page numbers for your destination pages before applying the script.

Solution 1Recommended

Use a MouseUp JavaScript Action on the Button

Attach a custom JavaScript snippet to the button's action properties to evaluate the score field and trigger the corresponding page jump.

In PDF JavaScript processing, page numbering is strictly zero-based. This means that the first page is considered page 0. If you want a user to land on page 10, your script must point to pageNum 9. Furthermore, converting the text field string into a numeric value is essential for mathematical range evaluations.

1
Open Button Properties

Right-click the button in your PDF form editor and select 'Properties'.

2
Navigate to the Actions Tab

Go to the 'Actions' tab, choose 'Mouse Up' as the Trigger, and select 'Run a JavaScript' as the Action, then click 'Add'.

3
Define the Score Variable

In the JavaScript Editor window, type: var score = Number(this.getField("Score").valueAsString); (Replace "Score" with your actual text field name).

4
Add Conditional Page Jumps

Add 'if' statements to define your ranges and target pages. For example: if (score >= 0 && score <= 5) this.pageNum = 9; if (score >= 6 && score <= 10) this.pageNum = 19;

5
Save and Test

Click 'OK' to save the script, close the Properties dialog, exit form editing mode, and test the button by entering different scores.

Use a MouseUp JavaScript Action on the Button
Zero-Based Indexing Reminder: Always subtract 1 from the visible page number you see in your document viewer to get the correct 'pageNum' value for your JavaScript.
Advanced PDF Form Management

Easily Create Interactive PDFs with WPS Office

WPS Office offers a feature-rich PDF editor that makes it incredibly simple to add form fields, customize interactive buttons, and manage complex document navigation without needing expensive alternatives.

  1. 1. Open Your Document: Launch WPS Office and open your PDF file using the built-in PDF editor.
  2. 2. Access the Form Tab: Navigate to the 'Form' tab on the top ribbon to reveal interactive controls.
  3. 3. Insert Form Controls: Click on 'Text Field' or 'Push Button' to draw the necessary interactive elements onto your page.
  4. 4. Configure Actions: Double-click your new button to open its properties, where you can customize triggers and assign interactive behaviors.
Seamlessly insert and edit PDF text fields and push buttons.High format compatibility with Adobe Acrobat PDF standards.Lightweight, fast, and features a user-friendly interface.Cost-effective solution for everyday PDF document editing.
QA img-9

Frequently Asked Questions

Why does my PDF button jump to the wrong page?

This usually occurs because PDF JavaScript uses zero-based page numbering. If you want the button to take users to page 30, your script needs to read 'this.pageNum = 29;'.

Will this JavaScript button work on mobile PDF viewers?

Not necessarily. Many basic PDF viewers and default mobile readers do not support or actively block custom JavaScript executions. It is highly recommended that users open the interactive PDF in a robust desktop application like WPS PDF or Acrobat.

How do I make sure the score is read as a number instead of text?

Always wrap your field retrieval method inside the 'Number()' function (e.g., Number(this.getField("Field_Name").valueAsString)). This ensures the script treats the input as a mathematical digit for greater-than/less-than logic evaluations.