Developer forum

Forum » Templates » Retrieving recipient email from select

Retrieving recipient email from select

Nikki Strømsnes
Reply
I'm implementing several designs with a similar functionality, which I can't see how to solve gracefully.

Basically, it's a normal contact form, but the user should be able to select the recipient from a select box. As I see it, it's possible in the form module to specify a dynamic sender address, but you have to settle for one recipient in the module settings.

I have one possible solution, but I'm not sure if it'll work. What I do, is to create a hidden subpage for each recipient, with a cloned version of the form, but each with their respective recipient address. When I press submit on the main form, it will redirect to the chosen subpage, use the values from the main form, and then auto submit.

My concern is first and foremost, that I'm not sure how to go about it, but also that it's sort of a hack. Are there any better ways to do this?

Here's a jsFiddle example of what I want to accomplish: http://jsfiddle.net/TheNix/YKuWK/

Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer
Using the "old" forms module?

The recipient is in a hidden field:



<input type="hidden" name="Recipient" value="blabla@dynamicweb-cms.com" />
In your form create a select box with possible recipients. With JS add an event handler (onchange), that will change the value of the hidden field above.

Submit form - problem solved.

Votes for this answer: 0
 
Nikki Strømsnes
Reply

Ah, indeed!

 

Thanks, Nicolai.

 

This is only possible in the old forms module, right? Will it be possible to manipulate the form in a similar fashion in the future? 

 
Nicolai Høeg Pedersen
Reply
Hi Nikki

In the new forms module you can make your own formsaveprovider - and do whatever magic in there you want.

And yes - probably also going to be possible in future versions.

 

You must be logged in to post in the forum