Skip to main content
calvint80413960
Participant
November 30, 2017
Question

Send form to different email addresses depending on dropdown choice?

  • November 30, 2017
  • 1 reply
  • 393 views

I have a form which needs to be sent via a submit button to specific email addresses which are determined by what the user chooses. There are two dropdown boxes which will determine the location i.e.

Dropdown1 choice: London

Dropdown2 choice: Electrical

This will send it to the London office Electrical Team

Dropdown1 choice: Bristol

Dropdown2 choice: Construction

This will send it to the Bristol office construction team.

There are 6 options in Dropdown1 and 4 options in Dropdown2

I am using Acrobat Pro DC and javascript however cant get it to work. Any Ideas?

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
November 30, 2017

Do you have emails addresses for all of the different combinations?  The trick is to organize them into a data structure where the two choices automatically select for the correct email.

For Example:

var emailList = {"London":{"Electrical":"LEle@something.com","Construction":"LCon@something.com"},

                         ""Bristol":{"Electrical":"BEle@something.com","Construction":"BCon@something.com"}

}

Then email selection is just a matter of selecting from the list.

var email = emailList[ this.getField("DropDown1") ][ this.getField("DropDown1") ];

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often