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

Drop down selections to emails

Explorer ,
Nov 15, 2021 Nov 15, 2021

Copy link to clipboard

Copied

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

Views

1.2K

Translate

Translate

Report

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});

Votes

Translate

Translate
Community Expert ,
Nov 22, 2021 Nov 22, 2021

Copy link to clipboard

Copied

Sure. Use this:

 

if (this.getField("Text3").valueAsString!="")
emailBody +=this.getField("Text3").valueAsString;

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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;

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Almost... Try this:

 

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

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