Orchard Custom Form DropDownLists
Asked Answered
N

1

4

After a bit of playing around with Orchards' Custom Forms module, i decided i wanted to use a dropdownlist to select a particular person with their email as the value for that selected option. While i was creating the form i couldn't see anyway you could set values to your options.

See below image for example: Orchard Custom Form Content Type

Don't suppose anybody has come across this before or has a suggestion?

Noctiluca answered 4/2, 2013 at 11:24 Comment(4)
So you want the text to say something like 'Sales Department', but the value to say '[email protected]'. I'm not sure how you'd do this. Why do you want to?Annunciata
Yeah that's what I've been trying to do. Its because I'm migrating an existing website over to this CMS platform, and their old contact page had a dropdownlist where you would select a department and then from that selection shows associated employees in another dropdownlist for selective mailing. The selective mailing part i imagine can be handled within the rules, it's just the dropdownlist value part I'm unsure of.Noctiluca
It would be a bad idea to have a contact form that mailed to the email address that was a form input field. It'd be very easy for someone to change that value and use your form for sending spam.Annunciata
That's a good point, well i guess that's something i can say. Is there any sort of way to manage it internally instead of client side?Noctiluca
A
2

In your case I wouldn't worry about having different text and values for the fields. It's also potentially dangerous to make the recipient email an input of the HTML form.

The Custom Form Rule Event provided with Orchard gives you no way to look at the values of the content type created by the form. So, you're probably going to have to write your own. You should be able to base this on Orchard.CustomForms.Rules.CustomFormEvents.

Armed with this you'd be able to create new rules for each possible dropdown value and set the email address in the action for each rule.

Annunciata answered 4/2, 2013 at 15:4 Comment(1)
Thats an idea!! I'll give this a try and let you know.Noctiluca

© 2022 - 2024 — McMap. All rights reserved.