Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

UserDefined Forms


Go to End


5 Posts   1856 Views

Avatar
Hibari

Community Member, 9 Posts

13 November 2010 at 9:49am

Hi, I was wondering if anybody knew a possible solution for a type of field I want to use on the userdefinedform module.

What I'm trying to do is create a drop-down list of names of the coworkers and when a user clicks one of their names it will then send the email to the corresponding email of the user.

So, just as an example:

Andy
Fred
Cindy
Mark

if somebody clicked the name Cindy from the dropdown list, they could then fill out the text field and upon clicking send, the email would shoot to the email specified for Cindy.
If this is possible, it'd be a huge help.

Avatar
KS

Community Member, 10 Posts

13 November 2010 at 10:22am

If you are refering to using the User Forms Module http://silverstripe.org/user-forms-module/
Then you just need to add a dropdown field, then click show options to the right of the box. Click Add Option as many times as you need it and fill in the words in each box supplied.

That's it.

Hope that helps,
KS

Avatar
Hibari

Community Member, 9 Posts

13 November 2010 at 12:07pm

Hey KS, thanks for the quick reply.
Actually, what I was wondering about is how to get that to send an email to them though. Because, you can do a drop-down list. And then you could put their email addresses as the clickable choice. But, the company wants it so that rather than showing the email, it would just show their name, and that name would still send an email to their specified email. If I could, I'd love to do a comment code to make it unseen but still send the email to that email, but you can't even put code into the area to place names.

So, with that, here's my issue.

The one solution I thought would be to use the memberlist drop down, but you can't make that be the item to send to in the recepient list. So, that became another problem.

If you have an answer, that would be a huge help. Thanks so much for the first reply too!

-Hibari

Avatar
Willr

Forum Moderator, 5523 Posts

13 November 2010 at 1:18pm

Hi Hibari,

Currently like you said, you can put the email as the dropdown text and have it email the value in the drop down (The email recipient can be any value in a email field, option field or dropdown field) but no you cannot set a 'value' and a 'title' easily. It's been a feature that has been thrown around so I might have a go at supporting a 'Value' and a 'Title' options for dropdown fields but that would be a bit off.

I haven't tried the memberlist field for a while, you could edit the userdefinedform_emailrecipient class so that it looks for values in a member list field, that would be a good enhancement. Start by looking how it works roughly line 824-850 (http://open.silverstripe.org/browser/modules/userforms/trunk/code/UserDefinedForm.php). It would need another query to check for member list fields rather than multipleoptionfield and a bit of code to convert the ID to an email.

Avatar
Carrie_Lang

Community Member, 24 Posts

19 June 2011 at 4:16am

Is this question still something not doable with Userforms or is there a newer topic somewhere with the solution? I'm wondering a contact form with dropdown field where user chooses what's the subject of the contact and the email is send to the person who deals with that subject.