10448 Posts in 2223 Topics by 1719 members
|Go to End|
18 May 2011 at 10:18pm
I'm using UserForms on a couple of SS_powered website and I must say its very practical and allows me to quickly create a good contact form that allow visitors of the website to send email to my customer.
Would it be possible to add a condition to a dropdown that would direct a given message to a specified email address ?
if visitor selects option "a" in dropdown in contact form, email is sent to "email address x"
if visitor selects option "b", email is sent to "email address y" and so on ?
20 May 2011 at 12:59am Last edited: 20 May 2011 1:01am
I once needed exactly the same, make userforms send a email to a email address depending on what topic is selected in the dropdown
I forked userforms
even have an open pull request, but I don't mind willr not taking it, my code sucks
inline CSS + JS, had no other choice at that time, was in a hurry and had no time for clean coding
here is a link: https://github.com/Zauberfisch/silverstripe-userforms
I hope that helps
when I get time, I rewrite it in a proper way and look to it that it gets accepted, but no time for that at the moment :/
// Edit: if you have any questions, just hop on IRC, and stay a bit longer, it often takes me a bit till I check for new messages
20 May 2011 at 1:03am
I will give it a shot as soon as I get the chance. Should be tomorrow afternoon.
20 May 2011 at 8:34am
Zauberfisch: i did a test but havent noticed anything 'extra' that would allow me to create a dropdown that would then be used to redirect messages to a precise email receipients ?
any hints ?
23 May 2011 at 11:26pm
create a userforms page.
create a dropdown field.
add some values to the dropdown field.
You will notice there are now 2 fields, 1 is the label, the 2nd one the value (in our case the email should be the value)
save the page
go to the tab where you can select emails that get sent onsubmit.
there you have an option to send it to a email adress or you can select one of the fields from the dropdown.
in this dropdown you should see the name of the dropdown that you created in the form, select that, and save it.
if a user now uses the form and submits it, the email will be sent to the email adress selected.
NOTE: as said its not nice coded, and not fully tested yet, it might happen that you run into errors, for example if the user sends the form but has no email selected in the dropdown. (i just made the dropdown required to go around that).
23 May 2011 at 11:50pm
Great, thanx for this "tutorial". It works! Will test it further and will deploy for my client tomorrow.
31 May 2011 at 9:10am
Zauberfisch: i deployed for my client and it looks promising.
Just one question, is it possible to give 2 values for 1 option ? in other words, so that when visitor of website chooses one option, message is sent to two email receipients ?
6 February 2012 at 11:32pm
Awesome update, thank you very much!
|Go to Top|