PDF Editing Issues

Automatically Check a PDF Form Checkbox When an Interest Rate Is Entered

Muhammad TalhaMuhammad Talha Nov 19, 2026 868 views

Question details

Automatically select a row's checkbox when its interest-rate field contains a nonzero value and clear it when the field is blank or zero.

Automatically Check a PDF Form Checkbox When an Interest Rate Is Entered
Product
PDF forms
Device & OS
not provided
Scenario
A PDF form has an interest-rate field and a corresponding checkbox in each row.
Observed behavior
Each checkbox should reflect whether its corresponding rate is nonblank and nonzero.
Before you start

Open the form in a PDF editor that supports editing AcroForm fields and JavaScript, such as Adobe Acrobat Pro. Identify the exact field names for each interest rate and its corresponding checkbox.

Solution 1Recommended

Add a validation script to the interest-rate field

Use this method to update a checkbox when the user commits a new value in its corresponding rate field.

The script checks the first widget in the named checkbox field when the rate is a valid, nonzero number. It clears the checkbox for a blank, zero, or nonnumeric value. It accepts a trailing percent sign and a period as the decimal separator.

Form JavaScript must be enabled and supported by the PDF viewer. The checkbox index 0 is suitable for a single checkbox; check the widget index if the field contains multiple checkboxes.

1
Open the form editor

In Adobe Acrobat Pro, open the PDF and choose All tools > Prepare a form.

2
Open rate field properties

Double-click the interest-rate field, select the Validate tab, and choose Run custom validation script.

3
Enter the script

Click Edit and enter this script, replacing Checkbox1 with the exact checkbox field name: var raw = String(event.value == null ? "" : event.value).replace(/^\s+|\s+$/g, ""); var rate = Number(raw.replace(/%$/, "")); var box = this.getField("Checkbox1"); if (box) box.checkThisBox(0, raw !== "" && isFinite(rate) && rate !== 0);

4
Repeat and test

Click OK, repeat the script in each row's rate field using that row's checkbox name, and save the PDF. In Preview, enter a nonzero rate, zero, and a blank value, leaving the field after each entry to commit it.

Add a validation script to the interest-rate field
Existing values and viewer support: The validation script runs when the field value is committed; existing rates may need to be re-entered to update their checkboxes. Browser PDF viewers and other readers may not run form JavaScript.
Free Microsoft Office alternative

View PDFs and Work with Office Files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface and compatibility with common Office formats for easier migration. Use its PDF tools for everyday document work; the automatic checkbox script still requires a PDF editor and viewer that support form JavaScript.

Open and review PDF forms alongside other documentsCompatible with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXUse a familiar interface for everyday document tasksMove between PDF and Office documents in one application
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't the checkbox update while I type?

A validation script runs when the rate field value is committed, usually after you leave the field. Enter the rate and press Tab or click another field to test it.

How do I find the checkbox field name?

In Acrobat Pro, choose All tools > Prepare a form, double-click the checkbox, and look for its name in the field properties. Use that exact name in this.getField().

Will the script work in every PDF viewer?

No. The viewer must support AcroForm JavaScript and allow it to run. If a browser viewer does not update the checkbox, test the saved PDF in a JavaScript-capable PDF application.

How do I apply the rule to multiple rows?

Open each interest-rate field's Validate tab and add the script, changing Checkbox1 to the corresponding checkbox field name for that row. Test each row separately.