How to Create an Interactive PDF Quiz with Green and Red Feedback
Question details
The user wants to build an interactive quiz within a PDF where selecting an answer provides dynamic visual feedback through colored radio buttons.

- Product
- Device & OS
- not provided
- Scenario
- Designing a dynamic assessment form in a PDF document.
- Observed behavior
- The user needs the radio buttons to dynamically change their fill color to green for a correct selection and red for an incorrect selection upon clicking.
Ensure you are using a professional PDF editor that supports advanced form field creation and custom JavaScript execution.
Use Custom Mouse-Up JavaScript for Radio Buttons
By applying a short JavaScript snippet to the radio button's properties, you can trigger a color change based on the user's selection.
PDF forms support basic JavaScript execution, allowing you to manipulate field properties such as fill color dynamically. By binding a script to the 'Mouse Up' trigger, the color updates immediately after the user clicks their answer.
Open your PDF editor, navigate to the Form tools, and insert radio buttons next to your quiz options. Group them with the same field name so only one can be selected at a time.
Right-click the radio button you want to configure and select 'Properties'. Go to the 'Actions' tab.
Choose 'Mouse Up' from the Select Trigger dropdown menu. From the Select Action dropdown, choose 'Run a JavaScript' and click 'Add'.
In the JavaScript Editor window, type a conditional script that checks the value. For a correct answer, use 'event.target.fillColor = color.green;'. For incorrect answers, use 'event.target.fillColor = color.red;'. Save and close the properties window.

Easily Create Interactive PDF Forms with WPS Office
WPS Office provides a comprehensive suite of PDF form tools, making it simple to design interactive quizzes, insert radio buttons, and manage dynamic properties efficiently.
- 1. Open the PDF File: Launch WPS Office and open your quiz document in the PDF editor.
- 2. Navigate to Form Tools: Click on the 'Form' tab in the top ribbon to access interactive field options.
- 3. Insert Radio Buttons: Select the 'Radio Button' tool and click on the document to place the options for your quiz questions.
- 4. Adjust Properties: Double-click the inserted radio button to modify its appearance, grouping, and interactive actions.

Frequently Asked Questions
Do I need programming experience to create PDF quizzes?
While basic JavaScript helps for dynamic actions like custom color changes, you don't need to be an expert. Simple copy-and-paste scripts like 'event.target.fillColor = color.green' are often sufficient for basic interactive feedback.
Why isn't my JavaScript executing in the PDF reader?
Ensure that the PDF reader you or your users are using supports JavaScript. Additionally, check the software's security settings, as JavaScript execution is sometimes disabled by default to prevent malicious scripts.
Can I apply this color-changing effect to checkboxes as well?
Yes, the exact same principle applies to checkboxes. You can assign a custom mouse-up JavaScript action to a checkbox to alter its fill color based on whether it is checked or unchecked.
Will these dynamic colors work on mobile devices?
Interactive PDF features, particularly those relying on JavaScript, may have limited functionality on mobile PDF readers. It is highly recommended to test the interactive quiz on the specific mobile applications your audience will use.




