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

Submit dropdown value using Submit button Javascript

New Here ,
Nov 30, 2020 Nov 30, 2020

Copy link to clipboard

Copied

My javascript for my Submit button runs properly until I try to get the final value, shown below:

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
);

This script works just fine with the first four values, which are just text fields. However, the field "SellerContactTime" is a dropdown list with text options, and attempting to add it to this email causes my Submit button to do nothing.

 

Can someone tell me why I can't submit dropdown form values and how to solve the issue? Thanks!

TOPICS
Acrobat SDK and JavaScript

Views

120

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

correct answers 1 Correct answer

Community Expert , Dec 01, 2020 Dec 01, 2020

I would recommend you switch to using the mailDoc method, which doesn't have all of these limitations.

However, it also doesn't validate the required fields, like the submitForm method does, but that can be done using a script.

I've posted code that does that. Try searching the form for "validate required fields" and you should find some examples.

Likes

Translate

Translate
Community Expert ,
Nov 30, 2020 Nov 30, 2020

Copy link to clipboard

Copied

Check the Javascript console for errors.

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

Copy link to clipboard

Copied

If you used the correct field name there's no reason it shouldn't work. However, be aware that the mailto string has a character limit, and also it can't include line-breaks...

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

Copy link to clipboard

Copied

I would recommend you switch to using the mailDoc method, which doesn't have all of these limitations.

However, it also doesn't validate the required fields, like the submitForm method does, but that can be done using a script.

I've posted code that does that. Try searching the form for "validate required fields" and you should find some examples.

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
community guidelines
New Here ,
Dec 01, 2020 Dec 01, 2020

Copy link to clipboard

Copied

LATEST

Thanks!

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