How to Replace Acrobat Checkbox Off Value with No or Blank using JavaScript
Question details
The user needs to convert the default unchecked export value ("Off") of a PDF checkbox into a user-friendly string like "No", "Yes", or a blank field to be displayed in another form field.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where text fields need to display specific text based on whether a checkbox is checked or unchecked.
- Observed behavior
- By default, an unchecked checkbox returns the system value "Off", which is not ideal for final display purposes in calculated text fields.
Ensure your PDF editor supports JavaScript calculation scripts and identify the exact field names of both your checkbox and the target display field.
Use a Custom JavaScript Calculation Script
Apply a custom script to the target text field to evaluate the checkbox's state and return the desired text string dynamically.
In PDF forms, checkboxes are hardcoded to return 'Off' when unchecked. By using a ternary operator inside a custom calculation script, you can intercept this 'Off' value and output any text you prefer, such as 'No' or a completely blank space.
Right-click the text field where you want the resulting text to appear, and select 'Properties' from the context menu.
In the Properties dialog, go to the 'Calculate' tab. Choose 'Custom calculation script' and click the 'Edit' button.
Assuming your checkbox is named 'P', type the following code: event.value = "Pump: " + ((this.getField("P").value == "Off") ? "No" : "Yes");
If you want the field to appear completely blank instead of displaying 'No' when unchecked, change the script to: event.value = "Pump: " + ((this.getField("P").value == "Off") ? "" : "Yes");
Click 'OK' to close the JavaScript editor, then close the Properties window. Toggle your checkbox in preview mode to verify that the text updates correctly.

Create and Manage Fillable PDF Forms with WPS Office
WPS PDF offers a streamlined, user-friendly interface for creating interactive forms. You can easily add checkboxes, text fields, and configure properties without relying on complex external software.
- 1. Open WPS PDF: Launch WPS Office and open your document using the built-in PDF editor.
- 2. Access Form Controls: Click on the 'Form' tab on the top ribbon to reveal interactive form options.
- 3. Add Checkboxes and Fields: Select the checkbox tool to insert fields and double-click them to adjust their export values and appearance.
- 4. Save as Standard PDF: Save your document. Your interactive form will work seamlessly across all standard PDF readers.

Frequently Asked Questions
Why does my PDF checkbox default to 'Off'?
According to the standard PDF form specification, an unchecked checkbox always returns the export value 'Off'. This ensures the PDF reader software can easily distinguish between checked and unchecked states.
Can I change the default 'Off' value natively without using JavaScript?
No, the 'Off' state is hardcoded into the PDF format standard for unchecked boxes. To display a different text value, you must use a calculation script to interpret the 'Off' value dynamically.
How do I find the exact field name for my script?
Right-click the target form field in your PDF editor's Prepare Form mode, select Properties, and check the 'Name' field under the General tab. Use this exact name inside the this.getField() parameter.




