Skip to main content
Known Participant
July 23, 2018
Answered

Obtaining a Mailto URL based on Field Value

  • July 23, 2018
  • 2 replies
  • 5102 views

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

This topic has been closed for replies.
Correct answer try67

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

2 replies

Known Participant
July 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.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
July 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

athmana40
Participant
July 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?

try67
Community Expert
Community Expert
July 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...