• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: how to have email determined by selected value

how to have email determined by selected value 16 years 11 months ago #4213

  • tmcadmin
  • tmcadmin's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Is there a way to specify which email address to send the form too based on what value is selected? For example, if I want people to sign up for events, if event A is selected, I want the form sent to email address A. If event B is selected, I want the form sent to email B. I know I can have the form sent to several people, but I'd like to have the email address to be determine by what event is selected.

I hope that makes sense.<br><br>Post edited by: tmcadmin, at: 2008/08/17 00:15
The administrator has disabled public write access.

Re:how to have email determined by selected value 16 years 11 months ago #4301

If you can put up with the internal confusion of having the \"values\" of the selectbox options being the email addresses (the user won't see it, but it would be what gets put in the RSForm database), you could just use the selectbox field itself in the \"Email Form data to:\" line in the Emails tab. The Default Value for the selectbox would like something like:
email_A@domain.com|Event A,email_B@domain.com|Event B

If you need the options' values to be something else, you would have to use the form processing script (in the Scripts tab) to do something trickier - if you can figure out the internal variable/array name for the email To value, you could change it dynamically based on the user's selection, like with a switch-case statement or something.
The administrator has disabled public write access.

Re:how to have email determined by selected value 16 years 10 months ago #4952

  • rayge
  • rayge's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
I kinda get it but how would that work in a select box? especially if they could choose multiples?<br><br>Post edited by: rayge, at: 2008/10/04 22:23
The administrator has disabled public write access.

Re:how to have email determined by selected value 16 years 9 months ago #4958

You didn't mention the idea of multiples in your initial question. If you want multiples, you'll probably have to do what I said in my second paragraph: modify the Email To field in your \"Script Run on Form Process\". The values of the selectbox will be an array, and that will need to be transformed into a comma-delimited list - easy to do with just a couple lines of code, but it means that you have to get involved in the process using that script. Do you know PHP?

If you don't need multiples, I think it can be done without scripts. Just make your selectbox, and put the email addresses and the \"user-friendly\" names for the items in the Default Value box like this:
email_a@yourdomain.com|Event A,email_b@yourdomain.com|Event B,email_c@yourdomain.com|Event C
Each item that is separated by commas has two parts. The first is the \"value\" - what will be sent by the form when the user clicks Submit. In this case you'll want that to be the email address. Then, after a vertical bar character (\"|\") as a separator, the second item is what you want the user to see in the selectbox.

Then in the Emails tab, for the To field, put \"{selectboxname}\" (not including the quotes, and substitute the real name of your selectbox field, of course), because the value sent by the form will be substituted in that spot, and in theory, it will all work. Does that help?
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!