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"});
Change this:
{cTo: "Colette.Williams@sjp.co.uk"}
To:
{cTo: "Colette.Williams@sjp.co.uk", cSubject: "Message subject goes here"}
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"}
Copy link to clipboard
Copied
Thats Brilliant much appreciated as always
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
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 });
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?
Copy link to clipboard
Copied
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.