• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Is my submit button's Javascript too long?

New Here ,
Nov 30, 2020 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

Views

193

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
community guidelines
Community Expert ,
Dec 01, 2020 Dec 01, 2020

Copy link to clipboard

Copied

LATEST

Votes

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
community guidelines