Highlight Unselected Yes and No PDF Checkboxes in Adobe Acrobat
Question details
Highlight a pair of mutually exclusive Yes and No checkboxes when neither option is selected.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form has a Yes and No question that should be visually flagged when left unanswered.
- Observed behavior
- Both checkboxes should have a yellow background when unchecked and return to their normal background when an option is selected.
Open the form in Adobe Acrobat and use Prepare a Form to check the exact names of the Yes and No checkbox widgets. Confirm that the form already makes the two choices mutually exclusive; the highlighting script does not enforce exclusivity.
Add a Mouse Up script to both checkbox widgets
Use Acrobat JavaScript to update both checkbox backgrounds whenever the user clicks either option.
Open the PDF in Acrobat and choose All tools > Prepare a form. Select each checkbox and open Properties to verify its field or widget name.
Open the Yes checkbox Properties, select Actions, choose Mouse Up as the trigger and Run a JavaScript as the action, then select Add. Enter the script below, replacing both example names with the names in your form: var yes = this.getField("pg2_Q1.Check1.0"); var no = this.getField("pg2_Q1.Check1.1"); if (yes && no) { var neitherSelected = yes.value === "Off" && no.value === "Off"; yes.fillColor = neitherSelected ? color.yellow : color.white; no.fillColor = neitherSelected ? color.yellow : color.white; }
Open the No checkbox Properties and add the same script under Actions > Mouse Up > Run a JavaScript. Both fields need the action so either click updates the pair.
Save the PDF and exit Prepare a form. Click each checkbox and then clear the selection: both backgrounds should be yellow only when both values are Off.

Use WPS Office for everyday PDF and document work
WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. It can help with general PDF tasks and moving between compatible file formats, but it does not replace Acrobat for adding or testing this checkbox JavaScript.

Frequently Asked Questions
Why does the script check for Off instead of Yes or No?
Acrobat checkbox fields use Off when unchecked. Checking whether both values are Off identifies the unanswered state without depending on the selected export values.
Does the script prevent both checkboxes from being selected?
No. It only changes their background colors. Configure the form to make the choices mutually exclusive, or use a radio-button group for a single-choice question.
Why are untouched checkboxes not yellow when I open the PDF?
A Mouse Up action runs only when its checkbox is clicked. To flag untouched questions, run equivalent validation from a separate form action, such as a review button.
Why might the highlight not work in another PDF viewer?
Some PDF viewers do not support Acrobat JavaScript or may have JavaScript disabled. Test the saved form in Acrobat or Acrobat Reader with JavaScript enabled.




