1

I'd like to be able to attach custom JS to a Sprout Form which can be managed in the form builder. I need to add logic that will switch the email address of the recipient based on a choice from a select menu. For example, "Website Issues" goes to "websupport@mywebsite.com", and "Information" goes to "info@mywebsite.com".

Ideally this JS would be managed at the form builder level so it only loads for that specific form.

I'm in the testing phase of Sprout Forms, so I apologize if I'm missing something obvious.

1

You can do this with the default Email Dropdown field (no JS needed!). The Email Dropdown field lets you create a mapping between an item in the dropdown and an email:

Website Issues: websupport@mywebsite.com
Information: info@mywebsite.com

The Email Dropdown field obscures those emails in your template. And when you set up your Notification Email, you can reference your Email Dropdown field by its handle in your Recipients setting: {emailDropdownFieldHandle}

In the case you ever did wish to add JS to your templates, the best way to add it to your template is to use Template Overrides.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.