Multiply a Checkbox Value by a Text Field in Adobe Acrobat
Question details
Calculate a result in an Acrobat form by multiplying a text field value by a checkbox value.

- 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.
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.
Use a numeric checkbox export value in a custom calculation
Use this method when the selected checkbox should supply a specific numeric multiplier.
In Prepare a Form, open the Multiplier checkbox properties and select the Options tab. Enter a number such as 2 in Export Value.
Open the Result field properties, select the Calculate tab, choose Custom calculation script, and click Edit.
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 : ""; }
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.

Treat the checkbox as a yes-or-no control
Use this method when selecting the checkbox should multiply the text field by 1, regardless of its export value.
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.

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.




