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

Need help to check and uncheck - checkbox to trigger email

Community Beginner ,
Dec 20, 2023 Dec 20, 2023

Copy link to clipboard

Copied

Need some assistance as soon as possible please to understand exactly where I am going wrong and also some help to correct this. I am creating a form for document checklist within our department, each field is a checkpoint and has a textfield with suggestions of what they need to complete before it can progress, next to this is checkbox and once complete they check this off.  the following belows works for me and it attachs well however I cannot figure out the following, how to add text fields into the subject line and have also include text, CC emails from a text field in the script and for some reason when I uncheck the box its also bringing the email up and attaching document.

 

Anyone with great knowledge on this would be greatly appreciated, and yes I did a crash course on this to learn and not every term or script I fully understand

 

 

if (this.getField("Check Box Copyright 1st Check").valueAsString=="Yes") app.alert("if copyright checks at this stage is completed,continue to email.",3);
this.mailDoc({cTo: "WACEdocuments@scsa.wa.edu.au;manumalo.natasha87@gmail.com", cSubject: "COPYRIGHT 1st Check, <COURSE>,<YEAR>,<COURSE TYPE>,<DOCUMENT TYPE>,COMPLETE", cMsg: "Please see attached for your review, all copyright check have been completed CM notes updated."});

TOPICS
Create PDFs , How to , JavaScript , PDF forms

Views

669

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

You didn't use curly brackets:

if (this.getField("Check Box Copyright 1st Check").valueAsString=="Yes") {app.alert("if copyright checks at this stage is completed,continue to email.",3);
this.mailDoc({cTo: "WACEdocuments@scsa.wa.edu.au;manumalo.natasha87@gmail.com",
cSubject: "COPYRIGHT 1st Check, " + this.getField("Year/Unit").valueAsString + ", " + this.getField("Course Type").valueAsString + ", " + this.getField("Course Name").valueAsString + "COMPLETE";
cMsg: "Please see attached for your revie

...

Votes

Translate

Translate
Community Expert ,
Dec 20, 2023 Dec 20, 2023

Copy link to clipboard

Copied

1. To include more than one line of code in a single block you must enclose them in curly brackets, like this:

 

if (condition) {
dependent line of code
dependent line of code
dependent line of code
}
independent line of code

 

If you don't include those brackets only the first line directly following the condition will be attached to it. In your case that's the alert command.

 

2. To include the value of a field in a string you need to access it using getField and the valueAsString property, and then concatenate it using the + operator, like this:

 

cSubject: "COPYRIGHT 1st Check, " + this.getField("COURSE").valueAsString + ", " + this.getField("YEAR").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 Beginner ,
Dec 20, 2023 Dec 20, 2023

Copy link to clipboard

Copied

Thank you for sharing this advice very much appreciated, can I ask if you dont mind explaining more on your first point please, I understand what you have explained  and it makes sense why I have the issue of email still being triggered if check box unchcked, just formatting this I have tried your suggestion and I know I am incorrect!, I have already concatenate the subject but again I know I may have missed a point in your explanation.

Please also note this example I have properly put in the text fields needed for the subject line

 

if (this.getField("Check Box Copyright 1st Check").valueAsString=="Yes") app.alert("if copyright checks at this stage is completed,continue to email.",3);
this.mailDoc({cTo: "WACEdocuments@scsa.wa.edu.au;manumalo.natasha87@gmail.com",
cSubject: "COPYRIGHT 1st Check, " + this.getField("Year/Unit").valueAsString + ", " + this.getField("Course Type").valueAsString + ", " + this.getField("Course Name").valueAsString + "COMPLETE";
cMsg: "Please see attached for your review, all copyright check have been completed CM notes updated."});

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

Copy link to clipboard

Copied

You didn't use curly brackets:

if (this.getField("Check Box Copyright 1st Check").valueAsString=="Yes") {app.alert("if copyright checks at this stage is completed,continue to email.",3);
this.mailDoc({cTo: "WACEdocuments@scsa.wa.edu.au;manumalo.natasha87@gmail.com",
cSubject: "COPYRIGHT 1st Check, " + this.getField("Year/Unit").valueAsString + ", " + this.getField("Course Type").valueAsString + ", " + this.getField("Course Name").valueAsString + "COMPLETE";
cMsg: "Please see attached for your review, all copyright check have been completed CM notes updated."});}

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 Beginner ,
Dec 21, 2023 Dec 21, 2023

Copy link to clipboard

Copied

LATEST

Wow! thank you so much that worked!

Appreciate you and the adobe community for your assistance, ever since I have been learning my way through but this is beyond me so sometimes is best to ask the professionals.

 

enjoy your xmas!

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