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

Drop down selections to emails

Explorer ,
Nov 15, 2021 Nov 15, 2021

Hello,

If i have a drop down that has yes and no in it can I adjust the email body to show pre determined information if no is selected?

 

i.e. 

Are there scratches in panel work? "NO"

Email body: Warning, there are scratches in panel work

etc.

TOPICS
Acrobat SDK and JavaScript
2.5K
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

correct answers 1 Correct answer

Community Expert , Nov 15, 2021 Nov 15, 2021

You can use something like this:

 

var emailBody = "";
if (this.getField("Are there scratches in panel work?").valueAsString=="NO")
	emailBody = "Warning, there are scratches in panel work";

this.mailDoc({cTo: "me@server.com", cSubject: "Email subject goes here", cMsg: emailBody});
Translate
Community Expert ,
Nov 22, 2021 Nov 22, 2021

Sure. Use this:

 

if (this.getField("Text3").valueAsString!="")
emailBody +=this.getField("Text3").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
Explorer ,
Nov 24, 2021 Nov 24, 2021

I cant seem to get it to work? is it becuse it will only add the information from the text field if its blank?

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 24, 2021 Nov 24, 2021

My apologies, it is adding it straight onto the last line of the "no" values so i assume i need to use the following code?:

if (this.getField("Text3").valueAsString!="")
emailBody += \n this.getField("Text3").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
Community Expert ,
Nov 24, 2021 Nov 24, 2021

Almost... Try this:

 

emailBody += "\n" + this.getField("Text3").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
Explorer ,
Nov 24, 2021 Nov 24, 2021

is there anyway to put a space beneath the text field too?

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 24, 2021 Nov 24, 2021
LATEST

emailBody += "\n" + this.getField("Text3").valueAsString + "\n\n";

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