PDF Editing Issues

Show and Require a PDF Field Based on a Yes or No Choice in Adobe Acrobat

Maira MehtabMaira Mehtab Nov 19, 2026 869 views

Question details

Make a PDF form field visible and required when No is selected, and hidden and optional when Yes is selected.

Show and Require a PDF Field Based on a Yes or No Choice in Adobe Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A PDF form has Yes and No radio buttons that control whether another field needs to be completed.
Observed behavior
The dependent field should change its visibility and required status according to the selected radio button.
Before you start

Open the form in a desktop version of Adobe Acrobat that supports Prepare a Form and JavaScript actions. Note the exact name of the field you want to control and confirm that the Yes and No choices are radio buttons.

Solution 1Recommended

Add JavaScript actions to the Yes and No radio buttons

Use separate Mouse Up actions to change the dependent field whenever the user selects a radio button.

1
Open the form editor

Open the PDF in Acrobat and choose Tools > Prepare a Form. Find the dependent field and check its exact name in its properties.

2
Configure the Yes button

Open the Yes radio button's Properties and select the Actions tab. Set Select Trigger to Mouse Up and Select Action to Run a JavaScript, then click Add. Enter: this.getField("field").display = display.hidden; this.getField("field").required = false;

3
Configure the No button

Open the No radio button's Properties and, on the Actions tab, add a Run a JavaScript action for Mouse Up. Enter: this.getField("field").display = display.visible; this.getField("field").required = true;

4
Replace the field name and test

In both scripts, replace field inside the quotation marks with the dependent field's exact name. Save the PDF, exit form editing, and select each radio button to test visibility. If the form has a Submit button, test that it checks the required field when No is selected.

Add JavaScript actions to the Yes and No radio buttons
Check PDF viewer support: The actions run when the buttons are clicked. Test the form in the PDF viewer your recipients will use, because some viewers do not support Acrobat JavaScript or form validation. An existing selection may need separate initialization when the document opens.
Free Microsoft Office alternative

Work with PDFs and Office Documents in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface and support for common Office formats, making it easy to move between documents. For the conditional PDF JavaScript in this article, use Adobe Acrobat to configure and test the form.

Open and work with PDF documents alongside office filesCompatible with Microsoft Word DOCX, Excel XLSX, and PowerPoint PPTX formatsFamiliar interface for working with existing documentsFree, lightweight office suite for everyday tasks
microsoft office alternative - wps office

Frequently Asked Questions

Where do I find the dependent field's name?

In Acrobat, open Tools > Prepare a Form, select the field, and open its Properties. Use the exact field name in place of field in both scripts.

Why does the field stay visible when I select Yes?

Check the Yes button's Properties > Actions tab for a Mouse Up action set to Run a JavaScript. Confirm that the field name matches and that the PDF viewer supports Acrobat JavaScript.

Does marking a field as required prevent me from saving the PDF?

Not necessarily. The required setting is generally checked during form submission, so test it using the form's Submit button if one is present.

Will the field update automatically when the PDF opens?

The Mouse Up actions run when a user clicks a radio button. A form with an existing selection may need separate initialization on opening to synchronize the dependent field.