How to Make a PDF Button Cycle Through Three Symbols on Click
Question details
Configure a PDF button field so that repeated clicks cycle its display through different visual symbols.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where a single button needs to represent multiple dynamic statuses, such as approved, warning, or denied.
- Observed behavior
- The user wants a button that changes its caption (symbol) and potentially its text color sequentially on each consecutive click.
Ensure you are using a PDF editor that supports advanced form field properties and custom JavaScript execution to implement dynamic button behaviors.
Use a Mouse-Up Custom JavaScript to Cycle Captions
Create a custom script triggered on the 'Mouse Up' event to check the current button caption and dynamically replace it with the next symbol in the sequence.
This is the most flexible method, allowing you to cycle through any number of states, change text colors per state, and fully customize the sequence.
Open your document in a capable PDF editor and switch to the Form Editing or Prepare Form mode.
Right-click the target button field and select 'Properties' from the context menu.
Navigate to the 'Actions' tab. Select 'Mouse Up' as the trigger and choose 'Run a JavaScript' as the action. Click the 'Add' button to open the script editor.
Enter a script using a switch or if/else statement. Retrieve the current symbol with `event.target.buttonGetCaption()`, determine what the next symbol should be, and set it using `event.target.buttonSetCaption()`. For instance, sequence from an empty caption to a check mark, then an exclamation mark, and then a slash.
Within your script's conditions, add color adjustments like `event.target.textColor = color.red;` to visually distinguish the warning or slash states from the check mark.

Implement a Pre-built Tri-State Field
If you strictly need three states (e.g., Yes, No, N/A), applying a pre-configured tri-state checkbox script may be simpler than coding a full cyclic button from scratch.
Create Interactive PDF Forms with WPS Office
WPS Office provides robust PDF editing capabilities, making it highly intuitive to add interactive buttons, manage form fields, and build professional, interactive documents.
- 1. Open PDF in WPS Office: Launch WPS Office and open your target PDF document.
- 2. Navigate to Form Tools: Click on the 'Form' tab located on the top ribbon.
- 3. Insert a Push Button: Select 'Push Button' and draw the interactive field directly onto your document page.
- 4. Configure Properties: Double-click the newly created button to open its Properties dialog, where you can adjust its appearance and bind actions.

Frequently Asked Questions
Why are my button symbols showing as random letters instead of check marks?
This happens when the button's font style is set to a standard text font like Arial or Times New Roman. You must change the field's font property to a symbol font, such as ZapfDingbats or Wingdings, to properly render character codes as visual symbols.
Can I change the color of the button depending on the specific symbol displayed?
Yes. Within your mouse-up JavaScript, you can dynamically assign a new text color for each state by adding a line like `event.target.textColor = color.red` (or green, black, etc.) alongside the script that changes the caption.
Is custom JavaScript absolutely required to make a button cycle through symbols?
Generally, yes. Standard PDF form field properties natively support click actions but do not feature a built-in 'cycle symbols' setting. Applying a custom JavaScript to the Mouse Up action is the standard industry approach for this behavior.
Will these interactive cyclic buttons work on all mobile PDF readers?
Not necessarily. Form field interactivity and JavaScript execution vary significantly across mobile PDF applications. It is strongly recommended to test your interactive PDF on the specific mobile apps your audience is likely to use.




