PDF Editing Issues

How to Create a PDF Submit Email Button with JavaScript

Adam DavisAdam Davis Nov 10, 2026 868 views

Question details

The form creator needs to implement a custom confirmation popup before a PDF form is submitted via email, bypassing the default mailto button action.

How to Create a Submit Email Button with JavaScript in PDF Forms
Product
Adobe Acrobat Pro DC
Device & OS
not provided
Scenario
Creating an interactive PDF form where users must confirm their submission before their default email client is triggered to send the document.
Observed behavior
The user wants to use JavaScript in Acrobat Pro DC to trigger a confirmation message instead of a direct mailto link, and needs to ensure this script executes successfully for end-users opening the form in Acrobat Reader DC.
Before you start

Ensure you have Adobe Acrobat Pro DC installed to author and edit form fields, as the free Acrobat Reader DC only allows users to execute JavaScript, not create it.

Solution 1Recommended

Add Custom JavaScript to the Submit Button in Acrobat Pro DC

Use the Prepare Form tool to replace the standard Submit action with a custom JavaScript snippet that triggers a confirmation alert before generating the email.

By default, a 'Submit a form' action immediately prompts the user's email client. To intercept this with a confirmation popup, you must remove the default action and use the Document Object Model (DOM) JavaScript methods `app.alert` and `this.mailDoc`.

1
Open the Prepare Form tool

Open your PDF in Adobe Acrobat Pro DC, navigate to the 'Tools' menu, and select 'Prepare Form' to enter form editing mode.

2
Edit the button properties

Right-click on your existing Submit button and select 'Properties'. If you don't have a button yet, use the top toolbar to add a new 'Button' field to your document.

3
Set the action to JavaScript

Navigate to the 'Actions' tab within the Button Properties window. Under 'Select Action', choose 'Run a JavaScript' from the dropdown menu, and click the 'Add' button.

4
Input the confirmation script

In the JavaScript Editor, enter a script that prompts the user. For example: var cResponse = app.alert({cMsg: 'Are you sure you want to submit this form?', nIcon: 2, nType: 2, cTitle: 'Confirm Submission'}); if (cResponse == 4) { this.mailDoc({cTo: 'your-email@example.com', cSubject: 'Form Submission'}); } Click 'OK' to save.

5
Test the form

Close the Prepare Form mode by clicking 'Preview' at the top right. Click your newly configured button to verify that the confirmation message appears before opening your email client.

Add Custom JavaScript to the Submit Button in Acrobat Pro DC
Compatibility with Acrobat Reader DC: The `this.mailDoc` JavaScript method is fully supported in the free Adobe Acrobat Reader DC. End-users will be able to click the button, see the confirmation, and submit the email without needing Pro DC.
Efficient PDF Form Management

Easily Fill, Edit, and Share PDF Forms with WPS PDF

While authoring complex JavaScript actions requires advanced, expensive tools, WPS Office provides a highly intuitive and user-friendly PDF editor. You can easily fill out interactive forms, add electronic signatures, and share documents directly via email without needing complicated scripting.

  1. 1. Open your PDF form: Launch WPS Office and open your interactive PDF form using the built-in WPS PDF tool.
  2. 2. Fill and sign the document: Use the 'Form' tab to easily input your data into text fields, checkboxes, and dropdowns, then use the 'Fill & Sign' feature to securely add your signature.
  3. 3. Share via Email directly: Once the form is complete, click the 'Menu' button in the top left corner, select 'Share and Send', and choose 'Email' to instantly attach the filled PDF to your default email client.
Seamlessly fill out interactive PDF forms without complex setups.Highly compatible with Adobe Acrobat PDF formats.Built-in document sharing and direct email functionality.Lightweight application that opens large PDFs instantly.
microsoft office alternative - wps office

Frequently Asked Questions

Can end-users submit a PDF form using the free Acrobat Reader DC?

Yes, as long as the form creator has correctly configured the submit button using a standard mailto action or supported JavaScript (like this.mailDoc), users can submit the form using the free Acrobat Reader DC.

Why is my PDF submit button not opening the email client?

This typically occurs if the user does not have a default desktop email client (such as Outlook or Apple Mail) configured on their operating system. Webmail users may need to save the PDF manually and attach it to an email.

Can I use a standard mailto link without JavaScript?

Yes. In the button properties under the Actions tab, you can select 'Submit a form' instead of JavaScript, and enter 'mailto:your-email@example.com' in the URL field. However, this method will not provide a custom confirmation popup.