Skip to main content
Participant
December 1, 2020
解決済み

Submit dropdown value using Submit button Javascript

  • December 1, 2020
  • 返信数 2.
  • 886 ビュー

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!

このトピックへの返信は締め切られました。
解決に役立った回答 try67

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.

返信数 2

try67
Community Expert
Community Expert
December 1, 2020

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...

try67
Community Expert
try67Community Expert解決!
Community Expert
December 1, 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.

TSanders1作成者
Participant
December 1, 2020

Thanks!

Bernd Alheit
Community Expert
Community Expert
December 1, 2020

Check the Javascript console for errors.