Submitting form depending on what's selected in dropdown list

New Here ,
Jan 19, 2021 Jan 19, 2021

Copy link to clipboard

Copied

Hi,

I'm new with forms and javascript, so bear with me!

I've managed to set up a form so the submit button sends it to a specified email address using javascript, and I've got that part all working fine (script below).

 

this.mailDoc({

 

cTo: "email",

 

cSubject: this.documentFileName + " from " + this.getField("Supervisors Name").valueAsString + ", " + this.getField("Sitelocation").valueAsString,

 

cMsg: "A completed Site Compliance Checklist has been submitted from " + this.getField ("Supervisors Name").valueAsString

 

});

 

However, this form is to cover five different worksites, and i'd like to use a dropdown list for the user to choose which site they're working on. Depending on what site they then choose from that list, it'll then have a different email address to be sent to.

Can anyone help with how I can set up the submit button so it recognises what option's been chosen from the list, and then be able to send to the corresponding email address?

Happy to clarify further if that isn't quite clear.

 

Many thanks,

Andy

TOPICS
How to, JavaScript, PDF forms

Views

33

Likes

translate

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
Most Valuable Participant ,
Jan 19, 2021 Jan 19, 2021

Copy link to clipboard

Copied

This tutorial was made for you: https://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address

To summarize, you can place the email address as the export value of the items in your drop-down and then use the field's value directly in your code as the value of the cTo parameter.

Likes

translate

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 ,
Jan 19, 2021 Jan 19, 2021

Copy link to clipboard

Copied

Thanks for your reply, very much appreciated. I'll have a read through this and try to decipher..will take a bit of trial and error!

Thanks again

Likes

translate

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