• 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: Problem with recipients from select

Problem with recipients from select 8 years 11 months ago #35146

  • andrea74
  • andrea74's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 22
  • Thank you received: 1
Hi, I just set up a dropdown menu with multiple options that would email to a specific recipient based on the dropdown selection.

Example

mail1@gmail.com|Afghanistan
mail2@gmail.com|Åland Islands
mail3@gmail.com|Albania
mail1@gmail.com|Algeria
mail1@gmail.com|American Samoa
mail2@gmail.com|Andorra
mail1@gmail.com|Bahamas
mail3@gmail.com|Bahrain
mail3@gmail.com|Bangladesh


The problem is that if in the list there are same e-mail address for different options, the returned value is always the first in the list. In the example, if a user select Bahamas the value is always related to Afghanistan (the first for mail1@).
If a user select Bangladesh the value is always related to Albania (the first for mail3@).

How to solve the problem?
Thank you.
Last Edit: 8 years 11 months ago by andrea74.
The administrator has disabled public write access.

Problem with recipients from select 8 years 11 months ago #35147

  • adrianp
  • adrianp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 631
  • Thank you received: 146
Hello,

What you're experiencing is actually normal as dropdown values should be normally kept unique.

Since you have the same values added multiple times, you should use a script on this instead and no longer use the "|" pipeline approach. For example, you can take these steps:

- remove the email addresses from the dropdown as well as the pipeline symbol.

- add a script within "Script called before the Admin Email is sent", I'm assuming you're using the Admin Email (while editing a form > Properties > PHP Email Scripts). For example whereas myDropdownName is the exact name of your dropdown (adjust as needed):
$dropSelection = $_POST['form']['myDropdownName'][0];
if($dropSelection == 'Afghanistan' || $dropSelection == 'Algeria'){
    $adminEmail['to'] = 'mail1@gmail.com';
}elseif($dropSelection == 'Andorra' || $dropSelection == 'Bahamas'){
    $adminEmail['to'] = 'mail2@gmail.com';
}else{
    $adminEmail['to'] = 'mail3@gmail.com';
}

If you're using the User Email instead, a similar approach would be required and you can read more on RSForm!Pro PHP Email Scripts areas here.
This is not official customer support. To receive your support, submit a support ticket here.
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!