Skip to main content
Inspiring
November 20, 2023
Answered

JavaScript Email alignment

  • November 20, 2023
  • 2 replies
  • 1165 views

I am working with a PDF form that has a submit button that emails the form and basic information. The javascript I am using works great, however, the alignment is off on the body of the email. When the button is pressed the email window comes up with:

Subject: Jobber Contact, Customer

New Warranty

Please enter and prepare to ship

Jobber Contact

Customer

When I enter data in the respective text boxes the email comes up with this (I've color-coded the lines that should be on the same line):

New Warranty

Please enter and prepare to ship

Jobber Contact

Customer

Product Repair Shop

Joe Blow

7015100

So how would I update my script to have the lines match?

 

var targetEmail = "me@email.com";

var subjectLine = this.getField("Jobber Contact").valueAsString + "  " this.getField("Customer").valueAsString;

var body = "New Warranty \nPlease enter and prepare to ship\nJobber Contact\nCustomer\nProduct " + this.getField("Jobber Contact").valueAsString + " " + "\n" + this.getField("Customer").valueAsString + " " + "\n" + this.getField("Product").valueAsString

this.mailDoc({cTo: targetEmail, cSubject: subjectLine, cMsg: body});

 

 

This topic has been closed for replies.
Correct answer Bernd Alheit

E.g. put

this.getField("Customer").valueAsString

between Customer and Product.

2 replies

Bernd Alheit
Community Expert
Bernd AlheitCommunity ExpertCorrect answer
Community Expert
November 21, 2023

E.g. put

this.getField("Customer").valueAsString

between Customer and Product.

Bernd Alheit
Community Expert
Community Expert
November 21, 2023

You must change the string for body.

glazed01Author
Inspiring
November 21, 2023

Thank you, can you elaborate?