How to Copy Physical Address to Postal Address with a PDF Checkbox
Question details
The user needs to configure a PDF form so that selecting a checkbox automatically duplicates data from physical address fields into matching postal address fields, and clears them when unchecked.

- Product
- PDF Editors
- Device & OS
- not provided
- Scenario
- Designing an interactive PDF form where respondents frequently share the same physical and mailing addresses, requiring an automated shortcut to save time.
- Observed behavior
- By default, form fields act independently. A custom JavaScript must be assigned to the checkbox to actively monitor the checked state and transfer or clear values accordingly.
Ensure you are in form editing mode and have finalized the exact names of all your physical and postal address text fields, as the script requires precise field name matching to function correctly.
Add a Mouse Up JavaScript Action to the Checkbox
Use a conditional JavaScript snippet tied to the checkbox's click event to copy values when checked and clear them when unchecked.
To automate form filling in a PDF, you can bind a JavaScript snippet to the 'Mouse Up' trigger of a checkbox. This script checks if the box is checked (not 'Off') and assigns the physical address values to the corresponding postal fields. If the box is cleared, it resets the postal fields to an empty state.
Enter PDF form editing mode. Right-click the target checkbox you want to use for the copy action and select 'Properties' from the context menu.
Navigate to the 'Actions' tab. Click the 'Select Trigger' dropdown and choose 'Mouse Up'. Then, click the 'Select Action' dropdown and choose 'Run a JavaScript'.
Click the 'Add' button to open the JavaScript Editor. Enter the assignment code. For example: if (event.target.value !== 'Off') { this.getField('Postal_Address1').value = this.getField('Physical_Address1').value; this.getField('Postal_City').value = this.getField('Physical_City').value; } else { this.getField('Postal_Address1').value = ''; this.getField('Postal_City').value = ''; }
Click 'OK' to save the script, then close the Properties window. Exit form editing mode to test the checkbox. Ensure that selecting the box pulls the entered text into the postal fields, and unchecking it clears them.

Use WPS PDF to Edit and Manage Interactive Forms
WPS Office offers a feature-rich PDF editor capable of handling form filling, annotation, and interactive PDF management efficiently, streamlining your document workflow.
- 1. Download and Install: Download WPS Office and launch the application on your computer.
- 2. Open the PDF Editor: Click on 'PDF Edit' from the home screen or open your existing interactive PDF document directly.
- 3. Interact with Forms: Navigate to the fields within the document to type in data, click checkboxes, and utilize embedded form scripts smoothly.
- 4. Save or Share: Once your form is filled, go to 'Menu' > 'Save As' to store your completed document locally or share it directly via email.

Frequently Asked Questions
What happens to the postal address fields if I uncheck the box?
If you include an 'else' condition in your JavaScript, unchecking the box will automatically clear the postal fields by setting their values to empty strings. Without the 'else' block, the copied text would simply remain in the postal fields.
Why is my PDF checkbox script not copying the text?
This usually happens if the field names referenced in your JavaScript do not exactly match the actual names of the text fields in the PDF form. Field names are case-sensitive. Double-check your spelling and capitalization in the form properties.
Will this JavaScript copy action work in all PDF viewers?
While Adobe Acrobat and robust PDF editors fully support JavaScript for interactive forms, some basic web browser PDF viewers or mobile readers might not execute custom scripts. It is recommended to advise users to open the form in a dedicated PDF application.
Can I copy multiple fields with a single checkbox?
Yes. Inside the 'if' statement of your script, you can include as many assignment lines as needed (e.g., for Address 2, City, State, and Zip Code) to copy all related physical address fields to their postal counterparts simultaneously.




