How to Copy Dates Between PDF Form Fields with Different Formats
Question details
The user needs to automatically copy a date from one PDF form field to a second field, format the second date differently from the first, and ensure the second field remains read-only.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Creating or modifying interactive PDF forms that require date synchronization across multiple fields with varying display formats.
- Observed behavior
- The user wants Date2 to automatically pull its value from Date1, display it in a distinct date format, and restrict users from manually editing Date2.
Ensure you are using a PDF editor that supports interactive form field creation and JavaScript calculation scripts. Note the exact, case-sensitive names of your source and destination date fields before proceeding.
Use a Calculation Script to Sync and Format PDF Form Dates
You can use a simple JavaScript command within the destination field's properties to automatically pull the value from the source field while maintaining independent format settings.
This method relies on custom calculation scripts available in standard PDF form properties. By configuring the calculation in the destination field, the PDF automatically grabs the data inputted into the source field.
Open your PDF in form editing mode. Right-click your first date field (Date1) and select Properties. Under the Format tab, set your preferred date format. Repeat this process for your second date field (Date2), choosing the different format you wish to display.
While still in the Properties menu for the second date field (Date2), navigate to the Calculate tab. Select the 'Custom calculation script' option and click the Edit button.
In the script editor window, type the following code: event.value = this.getField("Date1").value; (Make sure to replace 'Date1' with the exact name of your source field). Click OK to save the script.
To prevent users from manually altering the synchronized date, go to the General tab in the Properties of Date2. Check the 'Read-only' box, then close the Properties window and save your PDF.

Create and Manage Interactive PDF Forms with WPS Office
WPS Office provides robust PDF editing tools that allow you to easily insert, format, and manage interactive form fields, including automated date fields, checkboxes, and text boxes.
- 1. Open your PDF: Launch WPS Office and open your PDF document that requires interactive form fields.
- 2. Access Form tools: Navigate to the Form tab on the top ribbon to access the interactive form creation and editing tools.
- 3. Edit field properties: Double-click any form field to open its properties window, where you can set display formats, enable read-only status, and configure calculations.
- 4. Save your interactive form: Test your form fields to ensure data syncs correctly, then save your interactive PDF to share with clients or colleagues.

Frequently Asked Questions
Why isn't my destination date field updating automatically?
Ensure that the calculation script is correctly entered in the Calculate tab of the destination field. Additionally, verify that the field name referenced in your script (e.g., "Date1") perfectly matches the exact name of the source field, as JavaScript is case-sensitive.
Can I format the second date differently than the first one?
Yes. By setting the desired date format in the Format tab for each individual field, the script will pass the raw date value over, and the destination field will display it according to its own unique format settings.
How do I access form editing mode in my PDF editor?
In most professional PDF editors like WPS Office, you can access form editing mode by navigating to the "Form" or "Prepare Form" tab located in the main toolbar at the top of the screen.
Will making the field read-only prevent the script from working?
No. Setting a PDF form field to read-only only prevents manual keyboard input from the user. Background processes, like custom calculation scripts, will still execute normally and update the field's value.




