Skip to main content
Inspiring
March 13, 2024
Answered

PDF Form javascript submission - email format

  • March 13, 2024
  • 1 reply
  • 994 views

I suspect this is out of my control but I'm being told by end user that when they try to submit the form the email that's popping up is in plain text but they need it to generate in html format - this is primarily so that the user signature adds automatically (assuming it is set up that way) to the email.

Is there any way to do this? Or is it a local setting I can't affect?

The code attached to the submit button checks required fields then, assuming they're complete, creates email, cc'ing up to two people who add their details to the form:

var requiredFields = new Array();
for (var i = 0; i < this.numFields; i++)
{
var fName = this.getNthFieldName(i);
var f = this.getField(fName);
if (f.type!="button" && this.getField(fName).required && (this.getField(fName).value == null || this.getField(fName).value == ''))
{
requiredFields[requiredFields.length] = fName;}}
var error = "Please complete the following fields: \n\n";
for (j=0; j < requiredFields.length; j++)
{
if (requiredFields[j].value == null)
{
error = error + requiredFields[j] + '\n';
var f2 = this.getField(requiredFields[j]);
f2.setFocus();
}

}

if (requiredFields.length > 0) {
app.alert(error);
} else {

var cToAddr = "email@companyname.co.uk";
var cCCAddr = this.getField("Email1").value;
var cArAddr = this.getField("Email2").value;
if(cArAddr != "")
cCCAddr += ";" + cArAddr;
var cSubLine = "New request form";
var cBody="Generic message here.";


this.mailDoc({bUI: true, cTo: cToAddr, cCc: cCCAddr, cSubject: cSubLine,cMsg:cBody});
}

This topic has been closed for replies.
Correct answer try67

Not possible. A script can only generate a plain-text email message. If you include HTML tags in it maybe the email application you use will interpret it as an HTML page, but it's not guaranteed.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
March 13, 2024

Not possible. A script can only generate a plain-text email message. If you include HTML tags in it maybe the email application you use will interpret it as an HTML page, but it's not guaranteed.

Ozkim24Author
Inspiring
March 13, 2024

Thanks for speedy response!