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

Adding Subject Line text to Javascript code

Participant ,
Sep 16, 2020 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"});

TOPICS
Acrobat SDK and JavaScript

Views

508

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

Change this:

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

To:

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

Votes

Translate

Translate
Community Expert ,
Sep 16, 2020 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"}

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

Copy link to clipboard

Copied

Thats Brilliant much appreciated as always

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
New Here ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

Is there a way to customize the Subject Field?  I have a Staff Enrollment form. I'd like the add the Staff Member's name to the Subject Line to read "Staff Enrollment Form - John Doe".

 

Thanks

 

 

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 ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

Is this information available in a form field? If so, then yes, like this:

 

this.mailDoc({ cTo: "person@company.com", cSubject: "Staff Enrollment Form - " + this.getField("StaffMemberName").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
New Here ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

My apologies, I'm new to this and not quite sure I undestand.  I created a fillable form to gather the New Hire's information.  When you say is it available in a form field what are you referring to?

 

 

 

 

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 ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

LATEST

A fillable form is made out of form fields, the elements in which a user enters data, such as a text field. I assume that's what you're using.

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