How to Allow Manual Text Entry After a PDF Calculation
Question details
The user needs a PDF text field to automatically display 'N/A' when a Yes checkbox is selected, but still allow custom manual text entry without the calculation script continuously overwriting the input.

- Product
- PDF Forms
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where text fields conditionally auto-fill based on checkboxes but must remain manually editable.
- Observed behavior
- A calculation script runs whenever the form recalculates, constantly overriding and replacing any custom manual entries the user types.
Ensure you have access to advanced form editing tools and the JavaScript console in your PDF editor to modify field properties and behaviors.
Control Script Execution Using event.rc
Modify your custom calculation script to stop running when certain conditions are met, preventing it from constantly overwriting manual input.
A calculation script naturally runs whenever any part of the form recalculates. This causes it to replace manual input. By setting event.rc to false under specific conditions, you selectively prevent the calculation from committing its result, leaving the user's manual input intact.
Enter form editing mode in your PDF editor. Right-click the target text field that receives the calculation and select 'Properties'.
Navigate to the 'Calculate' tab and ensure 'Custom calculation script' is selected. Click the 'Edit' button to modify the script.
Enter your JavaScript to assign the 'N/A' value, then add a condition to control the event using event.rc. For example: event.value = 'N/A'; event.rc = (this.getField('Perform').value == 'Yes');
Click 'OK' to save the script, close the properties dialog, and exit form editing mode to test if the field now accepts manual edits when the condition is not met.

Use a Checkbox Action Instead of a Calculation Script
Trigger the field population using an action on the checkbox itself to avoid continuous form-wide recalculations.
Effortlessly Edit and Fill PDF Forms with WPS Office
WPS Office provides a comprehensive suite of PDF tools, allowing you to easily view, fill, and manage interactive PDF forms securely and quickly.
- 1. Download and Install: Download WPS Office Free from the official website and install it on your device.
- 2. Open Your PDF Form: Launch WPS Office and drag and drop your interactive PDF form directly into the application workspace.
- 3. Fill and Edit Fields: Navigate through the document and click directly on text fields, checkboxes, and dropdowns to input your data easily.
- 4. Save and Export: Once completed, click 'Save' or use the export options to share your finalized PDF securely.

Frequently Asked Questions
Why does my calculation script overwrite manual entry in Acrobat?
Calculation scripts trigger every time any form field in the document is updated (a recalculation event). If the script doesn't have a programmed condition to stop executing, it will constantly reapply its default calculation, overriding whatever text you just typed.
Can I conditionally make a PDF field read-only?
Yes. You can use JavaScript in your PDF form to set the field property to read-only based on user actions. For example, adding 'this.getField("FieldName").readonly = true;' when a specific checkbox is selected prevents manual entry entirely.
How do I insert text only if the PDF field is empty?
You can add an 'If' condition in your JavaScript trigger to check the current value before applying a new one. Using a statement like 'if (this.getField("FieldName").value == "")' ensures that you only insert 'N/A' if the user hasn't already typed a custom response.




