Make a PDF Text Field Required When a Checkbox Is Selected in Adobe Acrobat
Question details
Make a PDF text field required only when a specified checkbox is selected, including when another script changes the checkbox.

- Product
- Adobe Acrobat PDF forms
- Device & OS
- not provided
- Scenario
- A PDF form uses a JavaScript toggle to change a checkbox, and a related text field should be required when that checkbox is selected.
- Observed behavior
- The text field's required status should follow the checkbox value automatically.
Open the PDF in an Acrobat edition that supports form editing and JavaScript. In Prepare a Form, confirm the exact names of the checkbox and text field, and check that form calculations are enabled in Acrobat's Forms preferences.
Add a Conditional Required Calculation Script to the Text Field
Use this method when the text field's required status should follow the checkbox value.
Open the PDF in Adobe Acrobat and select All tools > Prepare a form. Locate the checkbox and the text field.
Open the checkbox's Properties and check its name on the General tab. The example script uses "Check Box12"; replace it with your checkbox's exact name if different.
Open the text field's Properties, select the Calculate tab, and choose Custom calculation script > Edit. Enter: event.target.required = this.getField("Check Box12").value == "Off" ? false : true;
Close the field properties and use Preview to select and clear the checkbox. Also run the existing toggle action and check that the text field becomes required only when the checkbox is selected.
If a programmatic toggle does not update the text field immediately, add this.calculateNow(); after the checkbox value change in the toggle script, then test again.

Edit and Review PDF Documents with WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Microsoft Office files, making it easy to move between document formats. Use Acrobat or another compatible form editor for the conditional JavaScript setup described above.

Frequently Asked Questions
Where should I put the conditional required script?
In Acrobat's Prepare a form tool, open the text field's Properties and select Calculate > Custom calculation script > Edit. The script updates the text field through event.target.
What if my checkbox has a different name?
Check its name under checkbox Properties > General, then replace "Check Box12" in this.getField("Check Box12") with that exact name.
Why doesn't the required status change when another script toggles the checkbox?
Check Acrobat's Forms preferences to ensure automatic field calculations are enabled. If the update still does not occur immediately, call this.calculateNow(); after changing the checkbox value in the toggle script.
Will every PDF viewer enforce the required field?
No. Viewers differ in their support for PDF JavaScript and form validation. Test the checkbox and form submission in the intended viewer; the required property does not necessarily prevent saving an incomplete PDF.




