How to Automatically Populate PDF Date Fields When Another Field Is Completed
Question details
The user needs several date fields across a multi-page PDF form to automatically fill with the current date whenever data is entered into a designated trigger field.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Designing an interactive PDF form where entering data into one specific field (such as a 'Receiving Unit' field) triggers updates in other parts of the document.
- Observed behavior
- The date fields currently remain blank and require manual data entry instead of updating dynamically when the target field is completed.
Ensure you have a PDF editor that supports form field scripting, such as Adobe Acrobat Pro, and take note of the exact field names for both the trigger field and the destination date fields.
Use Field-Level JavaScript to Auto-Populate Dates
Add a custom JavaScript calculation or validation script to your trigger field to automatically format and insert the current date into the destination fields.
By applying a custom script, Adobe Acrobat can actively monitor when a specific field is updated and push real-time information, like today's date, to other specified areas in the form. This eliminates repetitive typing and ensures consistency across a multi-page document.
Open your PDF document in Adobe Acrobat Pro, go to the Tools menu, and select 'Prepare Form' to reveal all interactive fields.
Right-click the field that will act as your trigger (e.g., the RECEIVING UNIT field) and select 'Properties' from the context menu.
Navigate to the 'Validate' or 'Calculate' tab, choose 'Run custom script', and click 'Edit'. Write a script that checks if the destination date fields are empty. If they are, use the command util.printd("mm/dd/yyyy", new Date()) to fetch and format the current date, then assign it to the target fields.
Close the properties dialog, save the PDF, and exit Prepare Form mode. Type a value into your trigger field and press Enter or click away to confirm that the four date locations update automatically.

Easily Fill and Manage PDF Forms with WPS Office
WPS Office offers a comprehensive, user-friendly PDF editor that allows you to effortlessly fill, edit, and manage interactive PDF forms without getting bogged down by complicated scripting.
- 1. Open Your PDF: Launch WPS Office and open the interactive PDF form you need to fill out.
- 2. Navigate to Form Filling: WPS Office automatically highlights interactive fields. Simply click on the text or date fields to begin typing your information.
- 3. Add Text and Dates Manually: If the form is not interactive, use the 'Insert Text' tool under the Edit tab to easily stamp dates or information anywhere on the pages.
- 4. Save and Share: Once completed, save your document. The output remains fully compatible with other standard PDF readers.

Frequently Asked Questions
Why isn't my JavaScript updating the date fields in Acrobat?
This usually occurs if the field names in your script do not exactly match the field names in your form, or if the calculation order is incorrect. Verify the spelling in your script and check the calculation order under the form properties menu.
Can I change the format of the auto-populated date?
Yes. You can customize the date format by altering the string within the util.printd function. For example, changing "mm/dd/yyyy" to "dd-mmm-yyyy" will display the date as '05-Nov-2023'.
Does WPS Office support complex JavaScript for PDF forms?
WPS Office supports standard interactive form filling and viewing. However, for executing advanced custom document-level or field-level JavaScript validations, specialized software like Adobe Acrobat Pro is typically required.




