Copy link to clipboard
Copied
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."
});
Copy link to clipboard
Copied
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."
});
Copy link to clipboard
Copied
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."
});
Copy link to clipboard
Copied
amazing, thank you so much!!!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more