0

I'm creating a Drupal 8 webform that will collect issues submitted by users. The users belong to different institutions, and I'd like to send the submission to the appropriate institutional contact (selected from a drop-down list in the form).

I've used conditional logic to create a handler "if [institution1] selected, email to [email protected]" and while it works well, I have a lot of institutions (and several different forms to create). Does anyone know if there is a faster way to conditionally assign a contact email for each institution, and to repeat/save this across multiple forms?

Added handler, set conditional logic to select if value "Institutional1" is filled. Duplicated handlers, changing the email and filled value each time.

3
  • I have not used webform for a while... But I would.. Have a content type of "institution" in the site with a field to hold the email address.. In the webform have a select element and then use a form alter to populate the select element with the instititions email and label(email as the value), then in your webform, you should be able to tell it to send the email to the selected value of the select element. Just my first thought on how I would do it. Saying that, there might already be a way to populate a webform select element with entity references. Commented Apr 15, 2023 at 0:14
  • The main point is, you should probably create a content type for saving the institutions (and its email address), then try to populate the form with the values rather than inputting them all multiple times. Commented Apr 15, 2023 at 0:17
  • Thank you @2pha that helps! I've created a predefined list for the Select element, with Option Value [Institutional email] and Option Text [Institution name]. The only challenge I am finding now is that when I edit the email handler, I can see the Institution names, but the email addresses are blank. I've added them in, and it's definitely faster than creating conditional handlers for each institution, but I am wondering why I don't see the email I already specified for that value. Commented Apr 17, 2023 at 15:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.