PDF Editing Issues

How to Add an Email Subject to Acrobat JavaScript Form Submissions

Algirdas JasaitisAlgirdas Jasaitis Nov 5, 2026 869 views

Question details

The user wants to automatically include a specific email subject line when submitting a PDF form via Acrobat JavaScript.

How to Add an Email Subject to Acrobat JavaScript Form Submissions
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Submitting an interactive PDF form via email using JavaScript code.
Observed behavior
The PDF form script successfully checks required fields and generates an email, but the resulting email is completely missing the subject line.
Before you start

Ensure you have permission to edit the JavaScript actions of your PDF form and that your computer's default email client is properly configured to handle mailto requests.

Solution 1Recommended

Configure the cSubject Parameter in the mailDoc Method

Modify your existing JavaScript to explicitly pass the subject string to the cSubject parameter.

When using the this.mailDoc method in Acrobat JavaScript, simply defining a subject variable in your script is not enough. You must explicitly assign that variable or text string to the cSubject parameter within the method call to ensure the generated email contains a subject line.

1
Open the PDF JavaScript Editor

Open your PDF form in Adobe Acrobat, enter Form Editing mode, and locate the button or trigger used for form submission. Right-click the button and select 'Properties'.

2
Edit the Form Button Action

Navigate to the 'Actions' tab. Select 'Run a JavaScript' from the list of actions, and click the 'Edit' button to open the JavaScript editor window.

3
Update the mailDoc Method

Locate your this.mailDoc function in the script. Add or update the cSubject parameter inside the method's curly braces. For example: this.mailDoc({cTo: "example@domain.com", cSubject: "Consultancy Request Form"});.

4
Save and Test Form Submission

Click 'OK' to save the script, close the properties window, and exit form editing mode. Click the submit button to verify that your email client opens with the correct subject line pre-filled.

Configure the cSubject Parameter in the mailDoc Method
Proper Variable Usage: If you are storing the subject in a variable (e.g., var mySubject = 'Form Submit';), ensure you pass the variable directly to the parameter like so: cSubject: mySubject.

Easily Manage and Share PDF Forms with WPS Office

Avoid complex JavaScript configurations for simple tasks. With WPS PDF, you can easily create, fill out, and share interactive PDF forms directly with colleagues or clients, streamlining your document workflow.

  1. 1. Open Your PDF Form: Launch WPS Office and open your interactive PDF form document.
  2. 2. Fill the Required Fields: Use the built-in form filling tools to input your data safely and efficiently.
  3. 3. Share via Native Email Integration: Click the 'Share' or 'Email' button on the top toolbar to automatically attach the PDF to your default email client, allowing you to quickly type a subject and send.
Easily fill, sign, and share interactive PDF forms without writing or debugging complex JavaScript.Fully compatible with all Microsoft Office formats, including Word, Excel, and PowerPoint.Lightweight and free all-in-one office suite for Windows, Mac, and mobile devices.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my Acrobat JavaScript email missing the subject line?

This typically happens if the subject text or variable is not explicitly mapped to the cSubject parameter inside the this.mailDoc method. Simply defining a variable in the script does not automatically apply it to the email output.

How can I add a dynamic subject line based on a form field?

You can retrieve a field value using this.getField('YourFieldName').value and assign it to a variable. Then, pass that variable to the cSubject parameter in your mailDoc function to make the subject dynamic.

Can I test PDF JavaScript form submissions without sending an email?

Yes. You can use the JavaScript console in Acrobat (using console.println) to print out your variables and verify that your subject string is formatted correctly before it triggers the mailDoc method.