Obtaining a Mailto URL based on Field Value
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";
