PDF Editing Issues

Validate Radio Buttons and Filter PDF Form Fields by Page in Adobe Acrobat

Camila MilosovichCamila Milosovich Nov 18, 2026 869 views

Question details

Check required PDF form fields on selected pages and include radio button groups in the empty-field alert.

Validate Radio Buttons and Filter PDF Form Fields by Page in Adobe Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
An Acrobat JavaScript validation routine filters form fields by page before reporting empty required fields.
Observed behavior
Required radio button groups can be omitted because their page property may be an array rather than a single page number.
Before you start

Open the form in Adobe Acrobat and identify the pages to validate; Acrobat JavaScript page numbers start at 0. In Prepare a Form, check that the fields you want to validate are marked Required.

Solution 1Recommended

Handle Single and Multiple Page Numbers in Acrobat JavaScript

Use this approach when a page-filtered validation script skips required radio button groups.

A radio group can have several widgets with the same field name, so its page property may contain an array of page numbers. A field should pass the page filter if any of those numbers matches a target page.

1
Open the validation action

In Acrobat, open Prepare a Form and locate the button or other action that runs your validation script. For a button, open Properties, select Actions, and edit the Run a JavaScript action.

2
Update the page check

Replace the page-filtering logic with a check that accepts both a number and an array. For example, use this script and change targetPages to the zero-based pages you need: var targetPages = [0, 1]; var missing = []; for (var i = 0; i < this.numFields; i++) { var field = this.getField(this.getNthFieldName(i)); if (!field || !field.required) continue; var pages = Array.isArray(field.page) ? field.page : [field.page]; var onTargetPage = false; for (var j = 0; j < pages.length; j++) { if (targetPages.indexOf(pages[j]) !== -1) { onTargetPage = true; break; } } if (!onTargetPage) continue; var value = field.valueAsString; if (value === "" || ((field.type === "radiobutton" || field.type === "checkbox") && value === "Off")) { missing.push(field.name); } } if (missing.length) app.alert("Please complete: " + missing.join(", "));

3
Test the alert

Save the action, leave a required radio group and a required text field empty on the target pages, and click the validation button. Then fill them in and repeat the test.

Handle Single and Multiple Page Numbers in Acrobat JavaScript
Radio group scope: The page filter includes a radio group if any widget is on a target page, but validation checks the value of the whole group. A selection on another page can therefore satisfy the group.
Free Microsoft Office alternative

Work With PDFs 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 helps you move existing documents into WPS, but it does not fix Acrobat's JavaScript validation logic.

Open and review PDF forms alongside other documents.Work with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTX.Use a familiar interface to ease migration from Microsoft Office.Access a free, lightweight office suite.
QA img-9

Frequently Asked Questions

Why does my page filter skip radio buttons?

Radio buttons in a group share a field name and can have multiple widgets. In Acrobat JavaScript, the field's page property can therefore be an array; check each page number against your target list.

How do I specify the first page in Acrobat JavaScript?

Use page number 0 for the first page, 1 for the second, and so on. For example, targetPages = [0, 1] selects the first two pages.

How can I tell whether a radio group is unselected?

In Acrobat JavaScript, check the group's value for "Off". The example also checks "Off" for checkboxes and an empty string for other required fields.

What happens if a radio group has widgets on more than one page?

The example includes the group if any widget is on a selected page, then checks the group's overall value. A selected widget on a different page may still satisfy that group.