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...
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.
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
"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."
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!
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.
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
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.
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...
Is this possible?
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
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, 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
Yup that's the one :)
Comment author was deleted
Also some details in this one: http://our.umbraco.org/forum/umbraco-pro/contour/15723-Sending-email-to-certain-email-address-dependent-on-selection-in-form
@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?
I also can't get rid of the first empty field in the drop down?
http://screencast.com/t/WcXVKAGER
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!!!
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?
*sigh*
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!
:)
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.
Tim,
How does one go about doing this:
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
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.
is working on a reply...