Skip to main content
Inspiring
Nov 20, 2023 10:50 PM UTC
Answered

JavaScript Email alignment

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 is closed to new replies. Start a new post to keep the conversation going.
Bernd Alheit
Bernd AlheitCorrect answer
Community Expert
Nov 21, 2023 2:19 PM UTC

E.g. put

this.getField("Customer").valueAsString

between Customer and Product.

3 replies

Bernd Alheit
Community Expert
Bernd AlheitCommunity ExpertCorrect answer
Community Expert
Nov 21, 2023 2:19 PM UTC

E.g. put

this.getField("Customer").valueAsString

between Customer and Product.

Translate
Bernd Alheit
Community Expert
Community Expert
Nov 21, 2023 8:25 AM UTC

You must change the string for body.

Translate
glazed01Author
Inspiring
Nov 21, 2023 2:00 PM UTC

Thank you, can you elaborate?

Translate