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

Send form to different email addresses depending on dropdown choice?

New Here ,
Nov 27, 2017 Nov 27, 2017

Copy link to clipboard

Copied

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

Another example

Dropdown1 choice: Bristol

Dropdown2 choice: Construction

This will send to the Bristol office construction team.

There are  6 options in Dropwdown1 and 4 options in dropdown2

I am using javascript but cannot get it to work. Any ideas?

Views

1.5K

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
Participant ,
Nov 27, 2017 Nov 27, 2017

Copy link to clipboard

Copied

You can use js to change the form's action field, based on the customer's choices from the dropdowns. Here is some related documentation: Customizing BC WebForms . Note that using this feature means the data from the form will not be stored in the site's database.

If you're running into some kind of js error, please provide the error message and your code.

Votes

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
Community Beginner ,
Apr 03, 2018 Apr 03, 2018

Copy link to clipboard

Copied

Not that it matters too much as BC is dying, but I was able to accomplish this today using JavaScript with a radio button and it WILL store in the database.

Basically, what you need to do is create copies of as many different forms as you need in BC. In my case, I needed 3 for three different options.

Each one will have its own unique form ID. Assign a workflow for each of these forms to the email address(es) you'd like the form to go to.

Then, create a function that will take place of the default form action using Boolean logic. I referenced the radio button id. If it's checked value equaled true, it would change the action to reference the web form id I created earlier.

I also wanted to stylize the submit button in JavaScript, so I created another script with similar logic to change the change the button value, background color, and mimic hover depending on the radio button selected.

This almost works. The radio buttons would change the workflow email addresses as expected, but it wouldn't save a lot of the data. This was because the field names changed each time we copied them earlier. In BC, go to each field and write down the field's name of each different form copy you created.

Lastly, I placed JavaScript in the same spot I modified the submit button text. The logic was getting the id of each field and then using the setAttribute("name", "") method. In other words, if this radio button is selected, change the field name to correspond with the webform id the submit action is referring to.

In your case, I'm assuming it would be similar to the radio button except you'd have to create a form variant for each option. I'm not the best at math, but I'd say you have 24 permutations. You should be able to concatenate the two dropdown items in Boolean logic using the && operator.

Votes

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 ,
Dec 10, 2019 Dec 10, 2019

Copy link to clipboard

Copied

LATEST

I know this post response you provided was some time back - but I have a similar request where my form results needs to be emailed to one of 8 recipients depending on which option they select from a dropdown.  Is there a JS I can utilise for this and simply copy and paste into the appropriate area within the Adobe PDF form JS functions?  Obviously I would update the email addresses and the actual dropdown values accordingly.  I hope you can assist!

Votes

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 ,
Dec 10, 2019 Dec 10, 2019

Copy link to clipboard

Copied

I know this post was some time back - but I have a similar request where my form results needs to be emailed to one of 8 recipients depending on which option they select from a dropdown.  Is there a JS I can utilise for this and simply copy and paste into the appropriate area within the Adobe PDF form JS functions?  Obviously I would update the email addresses and the actual dropdown values accordingly.  I hope you can assist!

Votes

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