Highlighted

Adding Subject Line text to Javascript code

Explorer ,
Sep 16, 2020

Copy link to clipboard

Copied

Hi,

I have been using the below code, which I found on this community, to alert required fields which works fine when all is good and the email pops up it is missing the subject line, can anyone help with the Javascript to add text to the Subject Field

 

Thanks in advance

Paul

 

var emptyFields = []; for (var i=0; i<this.numFields; i++) { var f= this.getField(this.getNthFieldName(i)); if (f.type!="button" && f.required ) { if (f.defaultValue==f.valueAsString) emptyFields.push(f.name); } } if (emptyFields.length>0) { app.alert("Error! You must fill in the following fields:\n" + emptyFields.join("\n")); } else this.mailDoc({cTo: "Colette.Williams@sjp.co.uk"});

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Change this:

{cTo: "Colette.Williams@sjp.co.uk"}

To:

{cTo: "Colette.Williams@sjp.co.uk", cSubject: "Message subject goes here"}

TOPICS
Acrobat SDK and JavaScript, How to, PDF forms

Views

69

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

Adding Subject Line text to Javascript code

Explorer ,
Sep 16, 2020

Copy link to clipboard

Copied

Hi,

I have been using the below code, which I found on this community, to alert required fields which works fine when all is good and the email pops up it is missing the subject line, can anyone help with the Javascript to add text to the Subject Field

 

Thanks in advance

Paul

 

var emptyFields = []; for (var i=0; i<this.numFields; i++) { var f= this.getField(this.getNthFieldName(i)); if (f.type!="button" && f.required ) { if (f.defaultValue==f.valueAsString) emptyFields.push(f.name); } } if (emptyFields.length>0) { app.alert("Error! You must fill in the following fields:\n" + emptyFields.join("\n")); } else this.mailDoc({cTo: "Colette.Williams@sjp.co.uk"});

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Change this:

{cTo: "Colette.Williams@sjp.co.uk"}

To:

{cTo: "Colette.Williams@sjp.co.uk", cSubject: "Message subject goes here"}

TOPICS
Acrobat SDK and JavaScript, How to, PDF forms

Views

70

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
Sep 16, 2020 0
Most Valuable Participant ,
Sep 16, 2020

Copy link to clipboard

Copied

Change this:

{cTo: "Colette.Williams@sjp.co.uk"}

To:

{cTo: "Colette.Williams@sjp.co.uk", cSubject: "Message subject goes here"}

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...
Sep 16, 2020 0
PerivanP LATEST
Explorer ,
Sep 16, 2020

Copy link to clipboard

Copied

Thats Brilliant much appreciated as always

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...
Sep 16, 2020 0