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

Obtaining a Mailto URL based on Field Value

Community Beginner ,
Jul 23, 2018 Jul 23, 2018

Our college has 9 different locations. I've had multiple requests to create a fillable PDF that would send the completed form (Submit Button) to a location-specific email address.

I created a Location field with pull down options.

I then created a hidden WhereTo field using Javascript to get the value from Location, and assigned the mailto as a text string.

I used the standard Form Tool to create the Submit a Form button. One of the fields asks for the URL to send the form. When I have built for going to just one location, I would enter the specific mailto: address.

How can I have the button's URL field get its value from the WhereTo field?

Here's my WhereTo script:

var Location = this.getField("Location").valueAsString;

if (Location=="Connected Classroom") event.value = "mailto:library@npc.edu";

if (Location=="LCC") event.value = "mailto:lcclibrary@npc.edu";

if (Location=="PDC") event.value = "mailto:pdclibrary@npc.edu";

if (Location=="SCC") event.value = "mailto:scclibrary@npc.edu";

if (Location=="WMC") event.value = "mailto:wmclibrary@npc.edu";

if (Location=="HOPI") event.value = "mailto:hopilibrary@npc.edu";

if (Location=="KAY") event.value = "mailto:kaylibrary@npc.edu";

if (Location=="SPE") event.value = "mailto:spelibrary@npc.edu";

if (Location=="STJ") event.value = "mailto:stjlibrary@npc.edu";

if (Location=="WRV") event.value = "mailto:wrvlibrary@npc.edu";

TOPICS
PDF forms
5.1K
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Jul 23, 2018 Jul 23, 2018

You should not include the "mailto:" part in the value of the field, just the email address. Since that part repeats itself in the final URL it doesn't have to be in the value of the field.

The answer to your question can be found here: https://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address

View solution in original post

Translate
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 ,
Jul 23, 2018 Jul 23, 2018

You should not include the "mailto:" part in the value of the field, just the email address. Since that part repeats itself in the final URL it doesn't have to be in the value of the field.

The answer to your question can be found here: https://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address

Translate
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 ,
Jul 23, 2018 Jul 23, 2018

I need to make a Mailto link to my website which is suppose to contain either the product name or the product page URL in the subject section. How can I do it?Exp: When you get an email through eBay about a product you are selling or buying, you automatically know what product that email is about by seeing the product name in the subject section.How can i do this?

Translate
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 ,
Jul 23, 2018 Jul 23, 2018

The tutorial I linked to above explains how to include a dynamic value in one of the fields of an email. Just use the same logic for the subject line, instead of the recipient email address...

Translate
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 ,
Jan 13, 2020 Jan 13, 2020
LATEST

Can you please guide me what to do fro mobile devices, as submit form button is not working on Run Javascript action

Translate
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 Beginner ,
Jul 24, 2018 Jul 24, 2018

The tutorial link provided, plus the note to remove the "mailto:" did the trick. Thank you to try67 for the quick and correct response.

Translate
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