PDF Editing Issues

How to Preserve Manually Entered Values in PDF Calculation Fields

Jason MillerJason Miller Nov 5, 2026 869 views

Question details

The user needs a way to prevent a custom JavaScript calculation script in a PDF form from erasing manually entered data when specific field conditions are not met.

How to Preserve Manually Entered Values in a PDF Calculation Field
Product
Adobe Acrobat / PDF Forms
Device & OS
not provided
Scenario
Filling out or designing interactive PDF forms where specific fields calculate values conditionally but should also permit permanent manual input.
Observed behavior
Manually entered text in the calculation field disappears and is replaced by an empty string as soon as the user clicks away or the field loses focus.
Before you start

Ensure you have access to the form editing or preparation mode in your PDF editor to view and modify custom calculation scripts.

Solution 1Recommended

Update the JavaScript with event.rc = false

Explicitly tell the PDF viewer to ignore the calculated result when the condition is false, allowing the manual input to remain intact.

Calculation scripts in PDF forms run automatically whenever any field in the document changes. If a script continuously calculates a value but lacks an explicit instruction for a false condition, it will overwrite your manual entries with a blank string.

By adding the 'event.rc = false' statement to your script, you prevent the script from applying its calculated result. This effectively tells the software to leave the field alone, allowing manual entries to persist.

1
Open the Form Field Properties

Right-click the target calculation field in your PDF editor's form preparation mode and select 'Properties' from the context menu.

2
Access the Calculate Tab

Navigate to the 'Calculate' tab, ensure 'Custom calculation script' is selected, and click the 'Edit' button.

3
Apply the Conditional Script

Update your script to handle the false condition. For example: `var a = this.getField("A").value; if (a == "EX") event.value = "EXAMPLE"; else event.rc = false;`. Ensure there are no missing quotation marks.

4
Save and Test

Click 'OK' to save the script, exit form editing mode, and test the field by entering a manual value to ensure it no longer disappears.

Update the JavaScript with event.rc = false
Syntax Check: Always double-check your JavaScript for typos or missing quotation marks, as syntax errors in the IF statement will prevent the script from executing properly.

Edit and Manage Interactive PDF Forms with WPS Office

WPS Office provides a comprehensive and user-friendly PDF editor that allows you to seamlessly view, fill out, and manage interactive PDF forms. Whether you need to input data into calculation fields or edit text directly, WPS Office handles standard PDF formats effortlessly.

  1. 1. Download and Install: Download WPS Office from the official website and open your interactive PDF document.
  2. 2. Access the Form Tools: Click on the fields to directly input your data. WPS PDF smoothly processes standard form formatting and background scripts.
  3. 3. Edit PDF Content: Use the 'Edit' tab if you need to modify static standard text, images, or layout elements directly within the PDF file.
Easily edit PDF text, images, and interactive form fields.High compatibility with Adobe Acrobat forms and standard PDF formats.Lightweight all-in-one suite with built-in Word, Excel, and PowerPoint alternatives.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my PDF form field clear itself automatically?

This usually happens because a custom calculation script is running in the background. Since calculation scripts trigger on any field change across the document, they will overwrite your manual entries with an empty string if they are not explicitly configured to ignore false conditions.

What does event.rc = false do in a PDF script?

The `event.rc = false` statement instructs the PDF software to reject or ignore the result of the calculation script. This preserves whatever value was manually entered or previously existed in the form field.

Can I use this JavaScript in any PDF viewer?

Advanced JavaScript for calculation fields is an Adobe Acrobat standard. While many premium PDF editors and modern viewers support these scripts, some basic web browsers or lightweight document viewers may not execute the JavaScript correctly.