PDF Editing Issues

Use an Acrobat Calculation Script to Update PDF Form Due Dates

John WilsonJohn Wilson Nov 19, 2026 868 views

Question details

Use a single calculation script to update a PDF form's due date when an assessment date or checkbox changes.

Use an Acrobat Calculation Script to Update PDF Form Due Dates
Product
Adobe Acrobat Pro
Device & OS
not provided
Scenario
An interactive PDF form has an assessment date, a checkbox, and a related due-date field.
Observed behavior
The desired result is for the due date to update automatically when the inputs change and clear when the checkbox is not selected.
Before you start

Open the form in Acrobat and identify the exact field names for the assessment date, checkbox, and due date. Confirm the date format and the number of days to add for your form.

Solution 1Recommended

Put the calculation script in the due-date field

Use the due-date field's calculation script to centralize the logic instead of duplicating it on checkboxes.

The example adds 30 calendar days to a date entered as mm/dd/yyyy. Replace the sample field names, date format, and interval with those used in your form.

1
Open the form editor

Open the PDF in Acrobat and select All tools > Prepare a form. Check the field names in the form editor.

2
Remove duplicate logic

Open each relevant checkbox's Properties and check the Actions tab. Remove only the duplicate scripts that calculate the same due date; leave unrelated actions in place.

3
Add the calculation script

Open the due-date field's Properties, select Calculate > Custom calculation script, and click Edit. Enter the following example, replacing assessment_date and BFR_checkbox with your actual field names: var assessment = this.getField("assessment_date"); var checkbox = this.getField("BFR_checkbox"); event.value = ""; if (assessment && checkbox && assessment.valueAsString && checkbox.valueAsString && checkbox.valueAsString !== "Off") { try { var date = util.scand("mm/dd/yyyy", assessment.valueAsString); if (date) { date.setDate(date.getDate() + 30); event.value = util.printd("mm/dd/yyyy", date); } } catch (e) { event.value = ""; } }

4
Test the form

Close the field properties and use Preview in Prepare a form. Enter an assessment date, select the checkbox, change the date, and then clear the checkbox to verify that the due date updates and clears.

5
Check calculation settings

If the field does not update, check Preferences > Forms for automatic field calculation and Preferences > JavaScript for Acrobat JavaScript. If the assessment date is itself calculated, use the form editor's field calculation order command to calculate it before the due-date field.

Put the calculation script in the due-date field
Test in the intended PDF viewer: PDF viewers differ in their support for Acrobat JavaScript. Test the saved form in the viewer that recipients will use.
Free Microsoft Office alternative

Use WPS Office for Everyday PDF and Document Work

WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. Its format compatibility makes moving existing files straightforward. Use Acrobat to create and test the calculation script described above.

Open and work with PDF forms alongside other documentsCompatible with Microsoft Office formats such as DOCX, XLSX, and PPTXFamiliar tools make it easier to move from Microsoft OfficeFree, lightweight suite for everyday document work
microsoft office alternative - wps office

Frequently Asked Questions

Where should I put the due-date calculation script?

In Acrobat's Prepare a form editor, open the due-date field's Properties and select Calculate > Custom calculation script > Edit. The script can read the assessment date and checkbox directly.

Why does the example clear the due date when the checkbox is unchecked?

The script starts by setting event.value to an empty string. It fills the due-date field only when the assessment date is present and the checkbox value is not Off.

How do I change the number of days added?

In the custom calculation script, replace 30 in date.setDate(date.getDate() + 30) with the number of calendar days your form requires.

What if the due date does not recalculate?

Check the field names, date format, and checkbox value first. Then check Acrobat's automatic field calculation and JavaScript settings, and verify the field calculation order if the assessment date is calculated.

Will the calculation work in every PDF viewer?

Not necessarily. PDF viewers vary in their support for Acrobat JavaScript, so open the saved form in the intended viewer and test changing the date and checkbox.