Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dominic Kelly 114 posts 133 karma points
    Jan 24, 2012 @ 20:16
    Dominic Kelly
    0

    Send email depending upon field selected

    So I have a drop down field in my form with 3 options. Is it possible to send an email to one of three people, depending on the value of the drop down selected? This is obviously quite a common form function...

  • Dominic Kelly 114 posts 133 karma points
    Jan 24, 2012 @ 23:01
    Dominic Kelly
    0

    Is this possible?

  • Tim 1193 posts 2675 karma points MVP 3x c-trib
    Jan 25, 2012 @ 10:35
    Tim
    1

    Hi Dominic, yes, its very straightforward!

    The simplest way to do it is to set up a a workflow for the forms on submit event. You can set the various settings to be pulled in from the fields of the form. If you look at page 19 of the developers manual here: http://nightly.umbraco.org/Umbraco%20Contour/1.1.12/Developer%20Docs.pdf you'll see an example of setting the email address to a field in the form. However, by default dropdowns in Contour have the same name/value. But if you use a pre-value source for the dropdown, you can have different name/values, allowing you to have the email address as the value in the dropdown.

    The other option is to write your own Workflow to workout which email to send to based on a field value. You can download the source code of the built in Worflows here: http://our.umbraco.org/projects/developer-tools/umbraco-contour-shared-source and use those to build your own one really easily! There's information about writing your own workflows in the developer docs as well.

    Hope that helps!

    :)

  • Comment author was deleted

    Jan 25, 2012 @ 10:54

    Hey Dominic,

    Another option is using the send xslt transformed email workflow and using the umbraco.library.sendmail function from within that xslt file, I think there is even an example on the forum so if you do a quick search it should turn up

  • Tim 1193 posts 2675 karma points MVP 3x c-trib
    Jan 25, 2012 @ 11:00
    Tim
    1

    @Tim, is this the one you mean? http://our.umbraco.org/forum/umbraco-pro/contour/23246-XSLT-transformed-email-umbracolibrarySendEmail-custom-From-address I had that bookmarked, but had completely forgotten about it!

    :)

  • Comment author was deleted

    Jan 25, 2012 @ 11:06

    Yup that's the one :)

  • Comment author was deleted

    Jan 25, 2012 @ 11:07
  • Dominic Kelly 114 posts 133 karma points
    Jan 25, 2012 @ 14:39
    Dominic Kelly
    0

    @TIm

    " But if you use a pre-value source for the dropdown, you can have different name/values, allowing you to have the email address as the value in the dropdown." 

    How do I go about adding a pre value source?

  • Dominic Kelly 114 posts 133 karma points
    Jan 25, 2012 @ 14:40
    Dominic Kelly
    0

    I also can't get rid of the first empty field in the drop down?

    http://screencast.com/t/WcXVKAGER

  • Dominic Kelly 114 posts 133 karma points
    Jan 25, 2012 @ 14:57
    Dominic Kelly
    0

    Ok - I'm kind of getting there. But how do I create a drop down like this using pre values??

    <select>

    <option value="[email protected]">Contact Sales</option>

    <option value="[email protected]">Contact Tech</option>

    </select>

    Using a custom drop down data type the value is always an integer!!!

  • Dominic Kelly 114 posts 133 karma points
    Jan 25, 2012 @ 15:00
    Dominic Kelly
    0

    In other words:

    http://screencast.com/t/g3U7ym5GwIhs

    The value of 35 needs to be an email address, and the Text needs to be a label...

    Impossible in Umbraco?

  • Dominic Kelly 114 posts 133 karma points
    Jan 25, 2012 @ 15:14
    Dominic Kelly
    0

    *sigh*

  • Tim 1193 posts 2675 karma points MVP 3x c-trib
    Jan 25, 2012 @ 17:27
    Tim
    0

    Hiya,

    Sorry, I have a job to do, so I can only pop on here in between other work! What you're trying to do is possible, but I haven't got time to post anything detailed right now. If you look at this article on Tim G's blog: http://www.nibble.be/?p=85 it shows using a database driven prevalue to do what you want. You can set up a table with the values you want in your database, and then fill in the settings to tell it which table to use, and which fields to use for the name/values in the dropdown. Hopefully that should give you enough to get this working!

    :)

  • Dominic Kelly 114 posts 133 karma points
    Jan 25, 2012 @ 17:34
    Dominic Kelly
    0

    No problem. I understand you have a job to do and I do appreciate the work. I just wish there was more documentation, and less bugs.

    Creating a database table just to hold 3 email addresses just seems nuts to me but I'll give it ago. Hopefully I won't get immediately stranded buy lack of shared knowledge.

  • Ryan Green 63 posts 83 karma points
    Jan 08, 2014 @ 20:36
    Ryan Green
    0

    Tim,

    How does one go about doing this:

    However, by default dropdowns in Contour have the same name/value. But if you use a pre-value source for the dropdown, you can have different name/values, allowing you to have the email address as the value in the dropdown.

    I have a db table with names in one column, and email addresses in another. But when adding a prevalue source to a dropdown, you can only select a Value (which would be the email address), there is no place to select the Name

  • Eric Patton 21 posts 51 karma points
    Feb 21, 2014 @ 16:58
    Eric Patton
    0

    Hey Tim,

    I've got the same question that Ryan has, I can't seem to find out anything that works to set the name/value to be different things. I've followed what was done on the site you suggested and set the emails as the value, but I have no idea where to set the name at. Surely this is doable somehow.

Please Sign in or register to post replies

Write your reply to:

Draft