Is my submit button's Javascript too long?

New Here ,
Nov 30, 2020

Copy link to clipboard

Copied

Not too long ago, I posted a question here about submitting form fields in a PDF, without sending the whole PDF (there are two forms on this document and each has its own submit button.) I correctly guessed that the following method would be the only way:

-Use JavaScript to construct an email, and populate the body of the email using the form fields.

 

Finding the right commands wasn't too hard. This script works just fine:

this.submitForm(
    "mailto:msanders2657@gmail.com?"  + 
    "&subject=good news" + "&body=" + 
"Name: " + this.getField("SellerFirstName").value + " " + this.getField("SellerLastName").value +
"\nEmail Address: " + this.getField("SellerEmail").value +
"\nPhone Number: " + this.getField("SellerPhone").value
);

This will construct an email with the body in this format:
Name: Jane Doe
Email Address: janedoe@example.com
Phone Number: (555)555-5555

 

However, the following updated script causes my Submit button to do nothing at all:

this.submitForm(
    "mailto:msanders2657@gmail.com?"  + 
    "&subject=good news" + "&body=" + 
"Name: " + this.getField("SellerFirstName").value + " " + this.getField("SellerLastName").value +
"\nEmail Address: " + this.getField("SellerEmail").value +
"\nPhone Number: " + this.getField("SellerPhone").value +
"\nBest Time to Contact: " + this.getField("SellerContactTime").value
);

 

All I'm doing here is adding another one of the fields to be listed. There are about 20 fields total, but it seems like this script completely breaks if I attempt to send more than four. Can someone tell me what I'm doing wrong here?

 

 

TOPICS
Acrobat SDK and JavaScript, Create PDFs, How to, PDF forms

Views

26

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Is my submit button's Javascript too long?

New Here ,
Nov 30, 2020

Copy link to clipboard

Copied

Not too long ago, I posted a question here about submitting form fields in a PDF, without sending the whole PDF (there are two forms on this document and each has its own submit button.) I correctly guessed that the following method would be the only way:

-Use JavaScript to construct an email, and populate the body of the email using the form fields.

 

Finding the right commands wasn't too hard. This script works just fine:

this.submitForm(
    "mailto:msanders2657@gmail.com?"  + 
    "&subject=good news" + "&body=" + 
"Name: " + this.getField("SellerFirstName").value + " " + this.getField("SellerLastName").value +
"\nEmail Address: " + this.getField("SellerEmail").value +
"\nPhone Number: " + this.getField("SellerPhone").value
);

This will construct an email with the body in this format:
Name: Jane Doe
Email Address: janedoe@example.com
Phone Number: (555)555-5555

 

However, the following updated script causes my Submit button to do nothing at all:

this.submitForm(
    "mailto:msanders2657@gmail.com?"  + 
    "&subject=good news" + "&body=" + 
"Name: " + this.getField("SellerFirstName").value + " " + this.getField("SellerLastName").value +
"\nEmail Address: " + this.getField("SellerEmail").value +
"\nPhone Number: " + this.getField("SellerPhone").value +
"\nBest Time to Contact: " + this.getField("SellerContactTime").value
);

 

All I'm doing here is adding another one of the fields to be listed. There are about 20 fields total, but it seems like this script completely breaks if I attempt to send more than four. Can someone tell me what I'm doing wrong here?

 

 

TOPICS
Acrobat SDK and JavaScript, Create PDFs, How to, PDF forms

Views

27

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 30, 2020 0
try67 LATEST
Most Valuable Participant ,
Dec 01, 2020

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 01, 2020 0