How to Submit a PDF Form to Different Emails Based on Drop-Down Selection
Question details
The user needs to configure an interactive PDF form so that the completed document is sent to one of several specific email addresses depending on the option selected in a drop-down list.

- Product
- PDF Forms
- Device & OS
- not provided
- Scenario
- Managing a worksite checklist or feedback form that requires routing submissions to different departments or locations based on user input.
- Observed behavior
- The form dynamically extracts the email address associated with the chosen drop-down option and populates it as the recipient in the email client when the submit button is clicked.
Ensure you have a PDF editor that supports form creation and custom JavaScript execution, and verify that all target email addresses are active and spelled correctly.
Use Drop-Down Export Values and a Custom JavaScript Submit Action
By assigning email addresses as the 'export value' for each drop-down item, you can use a short JavaScript code on your Submit button to dynamically set the recipient address.
This method relies on capturing the value of the drop-down list at the moment the user clicks the submit button. The JavaScript function 'this.mailDoc' then communicates with the default email client on the user's computer to draft the message.
Right-click the drop-down field (e.g., 'Sitelocation') and select 'Properties'. Go to the 'Options' tab. For each item in your list, type the corresponding email address into the 'Export Value' field and click 'Add'.
Insert a new button into your PDF form. Right-click the button, select 'Properties', and navigate to the 'Actions' tab.
From the 'Select Action' drop-down, choose 'Run a JavaScript' and click the 'Add' button.
In the JavaScript editor, input the following code: `this.mailDoc({ cTo: this.getField("Sitelocation").value, cSubject: this.documentFileName, cMsg: "Completed checklist submitted." });`. Replace "Sitelocation" with the exact name of your drop-down field. Click 'OK' to save.

Easily Fill and Manage PDF Forms with WPS Office
WPS Office provides a comprehensive and user-friendly PDF editor. Whether you are filling out complex interactive forms, managing drop-down selections, or reviewing checklists, WPS PDF ensures your data is handled smoothly.
- 1. Open WPS PDF: Launch WPS Office and switch to the PDF tab.
- 2. Load Your Form: Open your interactive PDF form file.
- 3. Interact and Fill: Click on form fields and drop-down lists to quickly input your information.
- 4. Save and Submit: Save your filled document securely or use built-in share options to send it to the required recipient.

Frequently Asked Questions
Why is my PDF submit button not opening an email draft?
This typically occurs if the user does not have a default email client (like Outlook or Apple Mail) configured on their computer, or if there is a typo in the JavaScript code, such as an incorrect field name.
Can I send the PDF form to multiple email addresses simultaneously?
Yes. You can enter multiple email addresses separated by semicolons in the drop-down's export value, or you can add the `cCc` or `cBcc` parameters to the `this.mailDoc` JavaScript function.
Will this JavaScript email submission work on mobile devices?
Most mobile PDF viewers have limited support for JavaScript. The `this.mailDoc` command may fail to execute on iOS or Android devices, so it is highly recommended that users fill and submit these forms on a desktop computer.
What happens if a user leaves the drop-down selection blank?
If the drop-down has no default selection and is left blank, the `cTo` parameter will be empty. The email client will still open, but the recipient field will be blank. It is best practice to set the drop-down field as 'Required' or define a default fallback option.




