Fix Checkbox and Radio Button Form Logic in Adobe Acrobat
Question details
The user needs a Notes field to appear only when a checkbox is unchecked and a radio button is set to No.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form uses JavaScript to control the visibility of a Notes field based on checkbox and radio button selections.
- Observed behavior
- The current script unexpectedly changes the radio button value instead of only checking its selection.
Open the PDF in Acrobat and use Prepare a form to check the exact field names and the radio button's export value. The example below assumes the checkbox is named Checkbox, the radio field is Choice.1, and the Notes field is named Notes.
Correct the comparison and update the Notes field visibility
Use a comparison operator to check the radio selection without assigning a new value.
A single equals sign assigns a value. Replace `this.getField("Choice.1").value = "No"` with `this.getField("Choice.1").value === "No"` to compare the existing value instead.
In Acrobat, open Prepare a form, right-click the checkbox, and select Properties. On the Actions tab, find the existing Run a JavaScript action and select Edit.
Replace the relevant logic with: `var checked = this.getField("Checkbox").valueAsString !== "Off"; var choice = this.getField("Choice.1").valueAsString; this.getField("Notes").display = (!checked && choice === "No") ? display.visible : display.hidden;` Replace the field names and `No` with the actual names and export value in your form.
In each radio button's Properties > Actions tab, add or update a Mouse Up action using Run a JavaScript with the same visibility logic, so changing either control can update Notes.
Select Preview in Prepare a form. Check that Notes is hidden when the checkbox is checked, visible when it is unchecked and the radio value is No, and hidden for other radio selections.

Work with PDF and Office files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with Office files and PDFs. Its format compatibility makes moving everyday documents easier, but it is not a replacement for editing or testing Acrobat-specific JavaScript form logic.

Frequently Asked Questions
Why does the radio button change to No when the script runs?
The expression `value = "No"` assigns No to the field. Use `value === "No"` to compare the existing value without changing it.
How do I find the radio button value to compare?
In Acrobat's Prepare a form tool, open the radio button's Properties and check its export value. Compare the script against that value, which may differ from the visible label.
When should the Notes field be visible?
With the logic shown, Notes is visible only when the checkbox value is Off and the radio field's value is No. It is hidden in all other combinations.
Where do I add the JavaScript so both controls update Notes?
In Prepare a form, open Properties > Actions for the checkbox and each radio button. Add or edit a Mouse Up action using Run a JavaScript, then test all combinations in Preview.




