PDF Editing Issues

Make Acrobat Form Fields Required When a Value Exceeds 1

Adam DavisAdam Davis Nov 19, 2026 869 views

Question details

Make several PDF form fields required when a controlling field contains a value greater than 1.

Make Acrobat Form Fields Required When a Value Exceeds 1
Product
Adobe Acrobat PDF forms
Device & OS
not provided
Scenario
A form uses an Adult text field to determine whether other fields must be completed.
Observed behavior
When the Adult value exceeds 1, the specified fields should become required; otherwise, they should remain optional.
Before you start

Open the PDF in a version of Adobe Acrobat that can edit form fields, and identify the exact names of the controlling and dependent fields. The PDF viewer used to fill out the form must support Acrobat form JavaScript.

Solution 1Recommended

Add a validation script to the controlling field in Acrobat

Use a custom validation script to switch several fields between required and optional based on the Adult field value.

1
Open the form editor

In Acrobat, open the PDF and select All tools > Prepare a form, or Tools > Prepare Form in older versions.

2
Open field properties

Double-click the Adult text field, select the Validate tab, and choose Run custom validation script. Click Edit.

3
Enter the script

In the JavaScript editor, enter: var fields = ["field1", "field2", "field3", "field4", "field5"]; for (var i = 0; i < fields.length; i++) { this.getField(fields[i]).required = Number(event.value) > 1; } Replace each sample name with the exact name of a dependent form field, and add or remove names as needed.

4
Save and test the form

Click OK, close the field properties, and save the PDF. Enter a value greater than 1 in Adult and leave the field to commit the value; then test with 1 or less. If the form has a submit button, test submission with dependent fields left empty.

Add a validation script to the controlling field in Acrobat
Required fields and submission: The Required property is generally checked when a PDF form is submitted; it does not necessarily prevent someone from saving the form with empty fields. Script and submission behavior can vary by PDF viewer.
Free Microsoft Office alternative

Work with PDFs and Office files in WPS Office

WPS Office is a free, lightweight alternative for working with PDFs and familiar Office documents. Its familiar interface and format support make moving everyday files straightforward; use Acrobat for the conditional form-field script described above.

Open and review PDF forms alongside other documentsCompatible with Microsoft Word, Excel, and PowerPoint formatsFamiliar interface for everyday document tasksFree, lightweight office suite for moving between file types
QA img-9

Frequently Asked Questions

Where do I find the names of the fields to use in the script?

In Acrobat, open Prepare a form and double-click each dependent field. Check its name in the field properties and use that exact name in the fields array.

What happens when the Adult value changes back to 1?

After the value is committed, the validation script sets the listed fields' Required property to false because the value is not greater than 1.

Why does the form still save with required fields empty?

The Required property is generally enforced during form submission, not when the PDF is saved. Test with the form's submit button if one is configured.

Will the script work in every PDF viewer?

No. The viewer must support the relevant Acrobat form JavaScript. Test the form in the viewer that recipients will use.