How to Submit a PDF Form to an Email Address Stored in a Field
Question details
The user wants to configure a PDF form button to submit data dynamically to an email address that is entered or stored in another field within the same form.

- Product
- PDF Forms
- Device & OS
- not provided
- Scenario
- Creating interactive PDF forms where the submission destination depends on user input.
- Observed behavior
- The user needs a method to dynamically retrieve an email address from a specific form field and use it as the submission destination instead of relying on a statically programmed email address.
Ensure you are using a PDF editor that supports JavaScript execution for interactive forms, and verify that the target email address field is properly named and accessible.
Use JavaScript to Dynamically Set the Submit Email Address
Add a custom JavaScript action to your submit button that retrieves the email address from another field and constructs the submission command.
By using JavaScript within your PDF form, you can read the value of a specific text field (such as an email input field) and dynamically construct a submission action. This allows the PDF data to be routed to different recipients based on what the user fills out.
Locate and note the exact name of the text field that contains the target email address (for example, 'EmailField').
Right-click the Submit button in your PDF form editor, select 'Properties', and navigate to the 'Actions' tab.
Choose 'Run a JavaScript' from the 'Select Action' dropdown menu and click 'Add'.
Input a script to retrieve the email and trigger the submission. For example: var email = this.getField('EmailField').value; if(email) { this.mailDoc(true, email, '', '', 'Form Submission'); }
Click 'OK' to save the script, exit form editing mode, and test the button by entering a valid email address in the designated field.

Create and Manage Interactive PDF Forms with WPS Office
WPS Office provides robust PDF editing capabilities, allowing you to easily design, fill, and manage interactive PDF forms, including text fields and push buttons.
- 1. Open your PDF document: Launch WPS Office and open the PDF document you want to edit or convert into a form.
- 2. Access form tools: Navigate to the 'Form' tab to access interactive form fields, buttons, and design tools.
- 3. Add and configure fields: Insert text fields and push buttons, then right-click them to access properties and configure their specific actions.

Frequently Asked Questions
Can I submit a PDF form without using JavaScript?
Yes, you can use the standard 'Submit a form' action in the button properties to send data to a static URL or a fixed email address. However, routing the submission dynamically to an address stored in another field strictly requires JavaScript.
Why isn't my mailto JavaScript working when I click submit?
This usually happens if the user's default email client is not properly configured on their device, or if the PDF viewer restricts JavaScript execution for security reasons. Ensure JavaScript is enabled in the viewer's preferences.
How do I validate the email address before submission?
You can use a Regular Expression (RegEx) within your JavaScript code to test the format of the retrieved email string. If the test fails, you can display an alert box to the user instead of triggering the submission function.




