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

run a javascript + email subject line

Community Beginner ,
Nov 11, 2021 Nov 11, 2021

Hi,
I am trying to run a javascript on a submit form button, to pull form fields to create the email subject line. It all works, apart from the fact that there are no spaces, so all the info appears such as 123456ClientNameProjectName.

Does anybody know how I can add a space between, its not critical, but it's just bugging me.

The code I am using is below, I am not very familiar with javascript, so any help much appreciated 🙂

 

var JobNumber = getField("JobNumber").value

var ClientName = getField("ClientName").value

var ProjectName = getField("ProjectName").value

this.mailDoc({ cTo: "email@address.co.uk",

cCc: "", cSubject: JobNumber + ClientName + ProjectName,

cMsg: "PLEASE ALSO ATTACH ANY SUPPORTING DOCUMENTS SUCH AS SPEC, BRAND GUIDELINES, COPY OR FURTHER INFORMATION."

 

});

TOPICS
JavaScript , PDF forms
2.1K
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Nov 11, 2021 Nov 11, 2021

Since the first field is a number you should use valueAsString instead of value.

Then, add a blank space after the string when creating the variables:

 

var JobNumber = getField("JobNumber").valueAsString + " ";

var ClientName = getField("ClientName").valueAsString + " ";

var ProjectName = getField("ProjectName").valueAsString;

this.mailDoc({ cTo: "email@address.co.uk",

cCc: "", cSubject: JobNumber + ClientName + ProjectName,

cMsg: "PLEASE ALSO ATTACH ANY SUPPORTING DOCUMENTS SUCH AS SPEC, BRAND GUIDELINES, COPY OR FURTHER INFORMATION."

});


Acrobate du PDF, InDesigner et Photoshopographe

View solution in original post

Translate
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 11, 2021 Nov 11, 2021

Since the first field is a number you should use valueAsString instead of value.

Then, add a blank space after the string when creating the variables:

 

var JobNumber = getField("JobNumber").valueAsString + " ";

var ClientName = getField("ClientName").valueAsString + " ";

var ProjectName = getField("ProjectName").valueAsString;

this.mailDoc({ cTo: "email@address.co.uk",

cCc: "", cSubject: JobNumber + ClientName + ProjectName,

cMsg: "PLEASE ALSO ATTACH ANY SUPPORTING DOCUMENTS SUCH AS SPEC, BRAND GUIDELINES, COPY OR FURTHER INFORMATION."

});


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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 ,
Nov 11, 2021 Nov 11, 2021
LATEST

amazing, thank you so much!!!

Translate
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