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

Email Javascript Submit Button

Explorer ,
May 10, 2023 May 10, 2023

I would like to to pull a name from a form field on my forms and place it where (add name from a form field here) in the script below. The script works perfectly as is, I would just like to add the name to each section. Can someone please help? Thanks

 

this.mailDoc({ cTo: "joeblow@myemail.com",


cSubject: "My Form for (add NAME from a form field here)",cMsg: "Please see the attached form in reference to (add NAME from a form field here) ."

 

});

 

TOPICS
How to , JavaScript , PDF forms
5.4K
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
1 ACCEPTED SOLUTION
Community Expert ,
May 17, 2023 May 17, 2023

Try this:

 

var str1 = this.getField("FirstName").valueAsString;
var str2 = this.getField("MiddleName").valueAsString;
var str3 = this.getField("LastName").valueAsString;
var sMsg = "Please see the attached Inquest Summary Report/Autopsy Authorization in reference to the death of " + str1 + " " + str2 + " " + str3 + ". If you have any questions, please feel free to contact my office. Thank you!"
var sSubject = "My Form";
this.mailDoc({ cTo: "joeblow@myemail.com", cSubject: sSubject ,cMsg: sMsg});


PDF Acrobatic, InDesigner & Photoshoptographer

View solution in original post

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 ,
May 11, 2023 May 11, 2023

Try this, after adjusting the field name:

 

var sName = this.getField("name").valueAsString;
var sSubject = "My Form for " + sName;
var sMsg = "Please see the attached form in reference to " + sName + ".";
this.mailDoc({ cTo: "joeblow@myemail.com", cSubject: sSubject ,cMsg: sMsg});


PDF Acrobatic, InDesigner & Photoshoptographer
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 ,
May 11, 2023 May 11, 2023

Thanks for your reply. I entered the code and replaced "name" with my form field name but nothing happened. 

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 ,
Sep 28, 2023 Sep 28, 2023

I need help with JavaScript I created a form and when the user hits the submit button I need the JavaScript to ask if no  email for where if no email form where

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
LEGEND ,
May 11, 2023 May 11, 2023

1. Where exactly did you enter this code, and how did you run it?

2. Was there anything in the JavaScript console?

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 ,
May 11, 2023 May 11, 2023

I entered the code in the action tab with javascript. 

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
LEGEND ,
May 11, 2023 May 11, 2023

And... question 2 please. 

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 ,
May 11, 2023 May 11, 2023

I appologize, but I'm still learning about javascript and not sure how to access javascript console.

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 ,
May 11, 2023 May 11, 2023

This was in the console

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 ,
May 12, 2023 May 12, 2023

The Console says your made a typo in the field's name.

JavaScript is case sensitive.


PDF Acrobatic, InDesigner & Photoshoptographer
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 ,
May 12, 2023 May 12, 2023

Thank you for your response. I will see if that works

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 ,
May 16, 2023 May 16, 2023

I double checked the spelling of the form field name and still getting the same response in the console. It's still not recognizing the form field name. Thanks for any help with this.

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 ,
May 16, 2023 May 16, 2023

This is the javascript that I would actually like to have if you could help me figure out how to pull the First, Middle, and Last name from the form fields in the pdf form. Each name has it's own field and are titled (FirstName) (MiddleName) (LastName). For some reason, the script will not recogzine the field name. This script works perfectly except it will not pull the fields into the message. Thank you!

 

this.mailDoc({ cTo: "joeblow@myemail.com",


cSubject: "Justice of the Peace Inquest Summary Report/Autopsy Authorization",cMsg: "Please see the attached Inquest Summary Report/Autopsy Authorization in reference to the death of (First Name) (MiddleName) (LastName). If you have any questions, please feel free to contact my office. Thank 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
Community Expert ,
May 17, 2023 May 17, 2023

Try this:

 

var str1 = this.getField("FirstName").valueAsString;
var str2 = this.getField("MiddleName").valueAsString;
var str3 = this.getField("LastName").valueAsString;
var sMsg = "Please see the attached Inquest Summary Report/Autopsy Authorization in reference to the death of " + str1 + " " + str2 + " " + str3 + ". If you have any questions, please feel free to contact my office. Thank you!"
var sSubject = "My Form";
this.mailDoc({ cTo: "joeblow@myemail.com", cSubject: sSubject ,cMsg: sMsg});


PDF Acrobatic, InDesigner & Photoshoptographer
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 ,
May 17, 2023 May 17, 2023

Thank you for your response again. For some reason it will not pull the form fields into the email. I have the fields labeled exactly like in the code.

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 ,
May 17, 2023 May 17, 2023

And the console has no errors. 

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 ,
May 17, 2023 May 17, 2023

Thank you so much for your help. I was able to get this to work perfectly. I found that I was leaving out a space in the field name. I'm clueless. Thanks again. 

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 ,
Dec 13, 2023 Dec 13, 2023

Is there a code to use after the email body to skip a line and add the email signature to the body after "Thank you!" as indicated below? Thank you for any help. 

 

var str1 = this.getField("FirstName").valueAsString;
var str2 = this.getField("MiddleName").valueAsString;
var str3 = this.getField("LastName").valueAsString;
var sMsg = "Please see the attached Inquest Summary Report/Autopsy Authorization in reference to the death of " + str1 + " " + str2 + " " + str3 + ". If you have any questions, please feel free to contact my office. Thank you!"
var sSubject = "My Form";
this.mailDoc({ cTo: "joeblow@myemail.com", cSubject: sSubject ,cMsg: sMsg});

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 ,
Dec 13, 2023 Dec 13, 2023
LATEST

I would like for the signature to look like this.

Charles Brewer

[PERSONAL INFORMATION REMOVED BY MODERATOR - THIS IS AN OPEN FORUM NOT ADOBE SUPPORT, PLEASE DO NOT POST PERSONAL INFORMATION]

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