Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Custom Content in Subject of mailto:

New Here ,
Oct 25, 2016 Oct 25, 2016

I've created a customer form using Adobe Acrobat XI Pro and want to have a field within the form display as part of the text in the Subject line of submitted forms. How do I customize the email subject line with content from a specific form field when one hits the form submit button with a mailto: action?

TOPICS
PDF forms
17.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 25, 2016 Oct 25, 2016

You would do it by embedding JavaScript in the Submit button.  It might looks something like this:

//Example JavaScript Submit Button

this.mailDoc({

bUI: false,

cTo: "anonymous@audioimagesinternational.com",

cSubject: "Review”,

cMsg: "Please review this document and return. Thank you.”

});

//End Example

In the "cTo:" line you can put the email address that you want, in the "cSubject:" line you can put your custom Subject line and in the "cMsg:" you can put a custom message.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 27, 2017 Jan 27, 2017

Hello. I have the same question, but I don't see that it has been answered. I have created a Submit Button and have figured out how to get it to email. Now, I would like the subject line of the email to auto populate with a form field. I've provided a few screenshots here if that helps. Any assistance would be great!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 27, 2017 Jan 27, 2017

So the value of the SID field should be the subject of the email?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 27, 2017 Jan 27, 2017

Hello! Yes, that's correct.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 27, 2017 Jan 27, 2017

Then use this JavaScript code as the MouseUp event of your Submit button, instead of what you currently have:

this.mailDoc({cTo: "access.docs@ashford.edu", cSubject: this.getField("SID").valueAsString});

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 27, 2017 Jan 27, 2017

When I try to test the script, I get the following error. My internet setting below seem to be correct. Maybe not?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 27, 2017 Jan 27, 2017

Check out the following web page that helps generate a email submission JavaScript and mailto commands:

www.fdftoolkit.net/email-pdf-mailto-generator.aspx

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 03, 2021 Nov 03, 2021

Hello,

I have changed my submit button to have the the java code:

this.mailDoc({cTo: "(Email Address)", cSubject: this.getField("(Text Field)").valueAsString});

which works perfectly! Only issue I have now is that previously I had some required text fields , the new code does not take these into consideration. What is the best method/ java code to keep them as required?

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2021 Nov 03, 2021
LATEST

You will need to either perform this validation yourself (I've posted code here that does that, search for "validateRequiredFields"), or use the submitForm command instead of mailDoc, which does it for you. Note that submitForm takes different kinds of input parameters, though.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 30, 2017 Jan 30, 2017

Here is a PDF example that should work for you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 27, 2017 Jan 27, 2017

For a button,without using JavaScript, the formatting would be exactly as it is in HTML.

mailto - Wikipedia

mailto: anonymous@adobe.com?subject=This%20is%20the%20subject&cc=someone_else@example.com&body=This%20is%20the%20body

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines