Copy link to clipboard
Copied
Hi All, I have a From with 4 fields. 1 text field(Date) and 3 Dropdown fields(Company, Site, and General Ledger). I have a submit button at the bottom that i use to send this form out to several different e-mails addresses. Is there any way that i can make the subject of the email a combination of the 4 fields, as follows: "DATE.COMPANY.SITE.GENERAL LEDGER"?
Copy link to clipboard
Copied
It shows how to use a dynamic value for the email address. The same principle applies to the subject line.
And combining strings is a basic functionality of JavaScript, which is also shown in that article.
Anyway, you can use this code to achieve what you described:
var mySubjectLine = this.getField("Date").valueAsString + "." + this.getField("Company").valueAsString + "." +
this.getField("Site").valueAsString + "." + this.getField("General Ledger").valueAsString;
this.mailDoc({cTo: "person1@server.com;person2@server.com", cSubject: mySubjectLine});
Copy link to clipboard
Copied
Copy link to clipboard
Copied
try67: I have read the article and do not see where is talks about combining multiple fields into one. Or how to set the Subject so it pulls information from the fields of the form.
Copy link to clipboard
Copied
It shows how to use a dynamic value for the email address. The same principle applies to the subject line.
And combining strings is a basic functionality of JavaScript, which is also shown in that article.
Anyway, you can use this code to achieve what you described:
var mySubjectLine = this.getField("Date").valueAsString + "." + this.getField("Company").valueAsString + "." +
this.getField("Site").valueAsString + "." + this.getField("General Ledger").valueAsString;
this.mailDoc({cTo: "person1@server.com;person2@server.com", cSubject: mySubjectLine});
Copy link to clipboard
Copied
i tried your code and it didnt work.
Here is my current code, A hybrid of my old code (which worked but only with a static subject)
I just added in your code for the cSubject.
I am not the best at coding and am pretty sure i have made a mistake or redundancy somewhere.
any heal would be nice.
Thanks
// to address
var cToAddr = "User@Mail.com";
// bcc address
var cBCCAddr = "";
//subject line
var cSubject = this.getField("Date").valueAsString + "." + this.getField("Company").valueAsString + "." +
this.getField("Site").valueAsString + "." + this.getField("General Ledger").valueAsString
//Body
var cBody = "Thank you for submitting your form.\n" + "Save the mail attachment for your own records";
// to address
var cEmailURL = "mailto:User@mail.com" + cBCCAddr + "&subject" + cSubject + "&body=" + cBody;
this.submitForm({
cURL: cEmailURL,
cSubmitAs:"PDF",
cCharSet:"utf-8"
});
Copy link to clipboard
Copied
Both versions should work.
If they don't then specify what happens, especially if there are any error messages in the JS Console.
Copy link to clipboard
Copied
There is no error message. Nothing happens when the submit button is clicked
Copy link to clipboard
Copied
Can you share the file in question with us, via Dropbox/Google Drive/Adobe Cloud/etc.?
Copy link to clipboard
Copied
Yes i can share it. On google drive
Copy link to clipboard
Copied
Then do it and post the link to it here, please.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
There are errors in the JS Console... Click the Submit button and then press Ctrl+J to see them.
Copy link to clipboard
Copied
I figured it out. I cant believe it but i forgot to name the fields on the form. the were still called dropdown1\2\3 so it wasnt working.
THanks for all of your help!
Copy link to clipboard
Copied
This Code Works (but will only give me a static Subject Line):
// to address
var cToAddr = "User@comp.com";
// bcc address
var cBCCAddr = "User@comp.com";
// subject line
var cSubLine = "Completed PO Form submitted";
// Body
var cBody = "Thank you for submitting your form.\n" + "Save the mail attachment for your own records";
var cEmailURL = "mailto:User@comp.com?Bcc=" + cBCCAddr + "&subject=" + cSubLine + "&body=" + cBody;
this.submitForm({
cURL: cEmailURL,
cSubmitAs:"PDF",
cCharSet:"utf-8"
});
This code does not work(The only difference is the subject line) :
// to address
var cToAddr = "user@comp.com";
// bcc address
var cBCCAddr = "user@comp.com";
// subject line
var cSubLine = this.getField("Date").valueAsString + "." + this.getField("Company").valueAsString + "." +
this.getField("Site").valueAsString + "." + this.getField("General Ledger").valueAsString;
// Body
var cBody = "Thank you for submitting your form.\n" + "Save the mail attachment for your own records";
var cEmailURL = "mailto:User@comp.com?Bcc=" + cBCCAddr + "&subject=" + cSubLine + "&body=" + cBody;
this.submitForm({
cURL: cEmailURL,
cSubmitAs:"PDF",
cCharSet:"utf-8"
});
I know that i must be making a stupid error but i can not see it. Any help would be appreciated.
THanks
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more