Make a PDF Text Field Required When Three Dropdowns Say Yes
Question details
Make a PDF text field visible and required only when three dropdown fields are all set to Yes.

- Product
- PDF form editor, such as Adobe Acrobat Pro
- Device & OS
- not provided
- Scenario
- A PDF form has three dropdowns and a text field that should appear only when all three answers are Yes.
- Observed behavior
- The text field should be visible and required when all three dropdowns equal Yes; otherwise, it should be hidden and optional.
Open the PDF in a form editor that supports Acrobat JavaScript, such as Adobe Acrobat Pro. Check the exact field names and the export value for each Yes option; the script must match those values.
Use an Acrobat calculation script to control the text field
Use this approach when the PDF will be completed in a viewer that supports Acrobat form JavaScript.
The script checks all three dropdowns whenever the form recalculates. It makes the text field visible and required only when every dropdown has the value Yes.
In Adobe Acrobat Pro, open the PDF and select All tools > Prepare a form.
Open each dropdown's Properties and check its field name and the export value for the Yes option. The example uses Dropdown1, Dropdown2, Dropdown3, and Yes; replace them in the script if your form uses different names or export values.
Open the target text field's Properties, select Calculate > Custom calculation script, and click Edit. Enter: var a = this.getField("Dropdown1"); var b = this.getField("Dropdown2"); var c = this.getField("Dropdown3"); var allYes = a && b && c && a.valueAsString === "Yes" && b.valueAsString === "Yes" && c.valueAsString === "Yes"; event.target.required = !!allYes; event.target.display = allYes ? display.visible : display.hidden;
Close the field properties, select Preview, and try every combination of dropdown values. Confirm that the text field appears and is required only when all three values are Yes.

Review PDF Forms and Office Files with WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDF and Microsoft Office files. Open compatible files in WPS for an easy transition, but use an Acrobat JavaScript-compatible editor and viewer for the conditional form behavior described above.

Frequently Asked Questions
Why doesn't the field appear when all three dropdowns show Yes?
In Prepare a form, check that the script uses the exact dropdown field names and Yes export values. Also confirm that form JavaScript and automatic field calculation are enabled in the PDF viewer.
Does the script erase the text when the field is hidden?
No. The script changes the field's visibility and required status but leaves its existing value intact.
Will the required setting stop users from saving an incomplete PDF?
Not necessarily. Required fields are generally checked when a form is submitted, and enforcement depends on the viewer and submission method.
Can I use this form in any browser PDF viewer?
Not all browser PDF viewers support Acrobat form JavaScript. Test the completed form in the viewer your recipients will use, or use an Acrobat viewer with JavaScript enabled.




