Clear a Calculated Date Field When the Balance Is Zero in Adobe Acrobat
Question details
Clear a calculated deduction date when the form's balance reaches zero.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- An Acrobat form calculates a future deduction date from an input date and stores it in the DateDeducted field.
- Observed behavior
- The date field should remain blank when the calculated balance is $0.00.
Open the form in Acrobat and identify the exact name of the balance field and the existing DateDeducted calculation script. Make sure the balance field's underlying value is numeric, even if it displays as currency.
Check the Balance in the Date Field's Calculation Script
Use this method when DateDeducted should be cleared based on a separate balance field.
Open the PDF in Adobe Acrobat and select Prepare a form. Double-click the DateDeducted field to open its properties.
On the Calculate tab, open the custom calculation script. Keep the existing date calculation, then add this code after it: var b = this.getField("Balance").value; if (b !== "" && !isNaN(Number(b)) && Number(b) === 0) event.value = ""; Replace Balance with the exact name of your balance field.
In Prepare a form, open the More menu and choose Set Field Calculation Order. Place the balance calculation before DateDeducted so the date script checks the updated balance.
Close the field properties and preview or use the form. Enter values that produce a positive balance and then a zero balance; confirm the date appears for the former and is blank for the latter.

Work With PDF and Office Files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDF and Microsoft Office files. Its format compatibility helps you move existing documents into your workflow. It does not fix or replace Acrobat's form calculation scripts.

Frequently Asked Questions
Why doesn't checking the date field for zero clear it when the balance is zero?
The date field's event.value refers to the date field itself, not the separate balance. In the DateDeducted calculation script, use this.getField with the balance field's exact name to check the balance.
Where do I find the field names in Acrobat?
Open Prepare a form and inspect the fields in the editor. Double-click a field and check its name in the field properties before using that name in a script.
Why is the date still showing after the balance reaches zero?
Check that the script uses the correct balance field name and that its underlying value is numeric. Also open More > Set Field Calculation Order in Prepare a form and ensure the balance calculates before DateDeducted.
Can I use a validation script to clear a field containing zero?
Yes. In the field's properties, open Validate and add the custom validation script if (event.value == 0) event.value = "";. This checks that field's own value; it does not check a separate balance field.




