Replace the Off Checkbox Value in an Adobe Acrobat Form Script
Question details
Prevent an unchecked checkbox value from appearing as Off in a calculated text field.

- Product
- Adobe Acrobat PDF forms
- Device & OS
- not provided
- Scenario
- A form calculation combines a checkbox value with other text and should use an alternative value when the checkbox is unchecked.
- Observed behavior
- The calculated text field displays Off because the script includes the value of an unchecked checkbox.
Open the PDF in Acrobat and identify the checkbox, the alternative-value field, and the calculated text field. Confirm their exact field names in Prepare a form before editing the calculation script.
Substitute another value in the Acrobat calculation script
Use this approach when an unchecked checkbox should contribute a different field value instead of Off.
An unchecked Acrobat checkbox returns Off. Rather than changing that default value, test for it and use a substitute when building the calculated text.
In Acrobat, open All tools > Prepare a form, then double-click the calculated text field to open its properties.
On the Calculate tab, select Custom calculation script and click Edit. In the existing script, read the fields as strings and choose the replacement: var s5 = this.getField("3E1.1(b)").valueAsString; var s6 = this.getField("Hidden").valueAsString; var x = (s5 === "Off") ? s6 : s5;
In the existing expression that builds the text assigned to event.value, replace the occurrence of s5 with x. Keep the rest of the expression intact, and replace the example field names with your actual field names if they differ.
Confirm the script changes, close the field properties, and use Preview in Prepare a form. Check and uncheck the box to verify that the calculated field shows the checkbox value when checked and the Hidden field value when unchecked.

Work with PDFs and Office files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office files. Its format compatibility helps you move existing documents into your workflow, though it does not replace the Acrobat JavaScript fix above.

Frequently Asked Questions
Why does my calculated field show Off?
An unchecked Acrobat checkbox returns Off. If your calculation concatenates that value into a text string, Off appears in the calculated field.
Can I change the default Off value of an unchecked checkbox?
No. Instead, check for Off in the calculation script and substitute an empty string or another field's value before building the output.
Where do I edit the calculated field's script?
In Acrobat, open All tools > Prepare a form, double-click the calculated text field, and select Calculate > Custom calculation script > Edit.
How do I leave the output blank when the checkbox is unchecked?
Read the checkbox value as a string and use an empty string for Off, for example: var x = (s5 === "Off") ? "" : s5;. Use x in the output expression.




