How to include a text value if checkbox is ticked into E-mail subject line?

New Here ,
Jun 26, 2018

Copy link to clipboard

Copied

I'm a newcomer in the JS world and need to create a JS code for sending a form via E-Mail using an action button.

See code below, I moreover don't have a clue how to put a text value in the subject line if a checkbox is ticked.

E.g.:

"required" (checkbox 1)

"not required" (Checkbox 2)

--> C1 is ticked --> write "required" in the subject line

--> C2 is ticked --> write "nrequired" in the subject line

--> both are ticked --> write "required" // "nrequired"

var mySubject=this.getField("Company").value+"//"+this.getField("ObjNr").value+"//Invoice"+this.getField("iMS Number").value+"//"+  ????

var

body='Hallo DM-Team,\n\nanbei erhalten Sie den ausgefüllten Antrag zur Stammdatenänderung für Personen\nsowie die benötigten Anlagen.\n\nMit besten Grüßen,\n\n'+this.getField("MitarbeiterPM").value;

this.mailDoc(false,"masa@gmx.com","","",mySubject,body)

Merci!!!

TOPICS
Acrobat SDK and JavaScript, Windows

Views

90

Likes

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

How to include a text value if checkbox is ticked into E-mail subject line?

New Here ,
Jun 26, 2018

Copy link to clipboard

Copied

I'm a newcomer in the JS world and need to create a JS code for sending a form via E-Mail using an action button.

See code below, I moreover don't have a clue how to put a text value in the subject line if a checkbox is ticked.

E.g.:

"required" (checkbox 1)

"not required" (Checkbox 2)

--> C1 is ticked --> write "required" in the subject line

--> C2 is ticked --> write "nrequired" in the subject line

--> both are ticked --> write "required" // "nrequired"

var mySubject=this.getField("Company").value+"//"+this.getField("ObjNr").value+"//Invoice"+this.getField("iMS Number").value+"//"+  ????

var

body='Hallo DM-Team,\n\nanbei erhalten Sie den ausgefüllten Antrag zur Stammdatenänderung für Personen\nsowie die benötigten Anlagen.\n\nMit besten Grüßen,\n\n'+this.getField("MitarbeiterPM").value;

this.mailDoc(false,"masa@gmx.com","","",mySubject,body)

Merci!!!

TOPICS
Acrobat SDK and JavaScript, Windows

Views

91

Likes

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
Jun 26, 2018 0
Most Valuable Participant ,
Jun 26, 2018

Copy link to clipboard

Copied

What about if neither of them is ticked?

Likes

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
Reply
Loading...
Jun 26, 2018 0
New Here ,
Jun 26, 2018

Copy link to clipboard

Copied

at least one must be ticked

Likes

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
Reply
Loading...
Jun 26, 2018 0
Most Valuable Participant ,
Jun 26, 2018

Copy link to clipboard

Copied

OK, then use this:

var requiredText = "";

var c1 = this.getField("C1").valueAsString!="Off";

var c2 = this.getField("C2").valueAsString!="Off";

if (c1 && c2) requiredText = "required // nrequired"

else if (c1 && !c2) requiredText = "required";

else if (!c1 && c2) requiredText = "nrequired";

var mySubject = this.getField("Company").value+"//"+this.getField("ObjNr").value+"//Invoice"+this.getField("iMS Number").value+"//"+  requiredText;

Likes

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
Reply
Loading...
Jun 26, 2018 0
New Here ,
Jun 26, 2018

Copy link to clipboard

Copied

thx but how can I include it in the subject line?  i guess a stupid questions but noo idea ...

Likes

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
Reply
Loading...
Jun 26, 2018 0
Most Valuable Participant ,
Jun 26, 2018

Copy link to clipboard

Copied

I already did that for you. Have a close look at the last line of the code...

Likes

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
Reply
Loading...
Jun 26, 2018 0
New Here ,
Jun 26, 2018

Copy link to clipboard

Copied

i think line 09. is missing some values ?

Likes

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
Reply
Loading...
Jun 26, 2018 0
New Here ,
Jun 26, 2018

Copy link to clipboard

Copied

ahhh got it, it's working ... nice dude you saved my life ... cheeers

Likes

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
Reply
Loading...
Jun 26, 2018 0