PDF Editing Issues

Multiply a Checkbox Value by a Text Field in Adobe Acrobat

Khadija KhanKhadija Khan Nov 24, 2026 868 views

Question details

Calculate a result in an Acrobat form by multiplying a text field value by a checkbox value.

Multiply a Checkbox Value by a Text Field in Adobe Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A beginner is creating a PDF form with a text field, a checkbox, and a calculated result field.
Observed behavior
The current JavaScript produces an incorrect result or NaN.
Before you start

Open the PDF in Adobe Acrobat and select Prepare a Form. Check the exact names of the text field, checkbox, and result field; the examples below use Amount, Multiplier, and Result.

Solution 1Recommended

Use a numeric checkbox export value in a custom calculation

Use this method when the selected checkbox should supply a specific numeric multiplier.

1
Set the export value

In Prepare a Form, open the Multiplier checkbox properties and select the Options tab. Enter a number such as 2 in Export Value.

2
Open the calculation editor

Open the Result field properties, select the Calculate tab, choose Custom calculation script, and click Edit.

3
Enter the script

Paste this script, replacing Amount and Multiplier with your exact field names: var amount = this.getField("Amount").valueAsString.replace(/^\s+|\s+$/g, ""); var multiplier = this.getField("Multiplier").valueAsString; if (multiplier === "Off" || multiplier === "" || amount === "") { event.value = ""; } else { var a = Number(amount); var m = Number(multiplier); event.value = isFinite(a) && isFinite(m) ? a * m : ""; }

4
Test the form

Close the properties dialog and use Preview in Prepare a Form. Enter a plain number in Amount, select the checkbox, and verify the result; clear the checkbox to confirm the result becomes blank.

Use a numeric checkbox export value in a custom calculation
Check invalid inputs: The script leaves the result blank if the text is not a valid number or the checkbox export value is not numeric. For example, use 1000 rather than 1,000 as the input.
Free Microsoft Office alternative

Work with PDFs and Office files in WPS Office

WPS Office is a free, lightweight alternative for everyday PDF and Office work, with a familiar interface and support for common file formats to make switching easier. It does not fix Acrobat's custom calculation script; use Acrobat to configure and test that form.

Open and review PDF documents alongside Office filesCompatible with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXFamiliar tools and interface for a smoother transitionFree, lightweight suite for everyday document work
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Acrobat calculation show NaN?

NaN can occur when the script tries to multiply text that cannot be converted to a number, such as the default checkbox export value Yes. In Prepare a Form, check the checkbox's Options tab and convert both inputs with Number() in the result field's custom calculation script.

Where do I set a checkbox's export value?

In Acrobat, open Prepare a Form, open the checkbox properties, and select Options. Enter the desired value in Export Value.

How can I leave the result blank when the checkbox is cleared?

In the result field's Calculate tab, edit the custom calculation script to check whether the checkbox value is Off. Set event.value to an empty string when it is.

What if the result does not update after another calculated field changes?

In Prepare a Form, check the field calculation order and place the result calculation after the fields it depends on. Then use Preview to test the form again.