• 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: Different admin mail to: based on selection

Different admin mail to: based on selection 15 years 3 months ago #6409

I need help with sending the admin email to different addresses depending on the selection made with a radio button field. I've seen other notes in the documentation and this forum but I just don't understand what is being said.

My situation is this:
Radio button field named "region" which has three different options: North, South, East. If North is selected, I want the admin email to go to This e-mail address is being protected from spambots. You need JavaScript enabled to view it , if South is selected, I want the admin email to go to This e-mail address is being protected from spambots. You need JavaScript enabled to view it , etc.

Exactly what do I put in the "items" field for the Radio component called "region" and the other parameters/attributes of this field, as needed.

Exactly what do I put in the "Admin Emails" parameters?

Any other fields/parameters that I need to do something with?

Thanks
The administrator has disabled public write access.

Re:Different admin mail to: based on selection 15 years 2 months ago #6578

I have a similar question but figure I wouldn't start a new thread....anyone have an answer for this?

I tried a few things I found throughout the site but nothing worked....
The administrator has disabled public write access.

Re:Different admin mail to: based on selection 15 years 2 months ago #6597

Here's my example and the solution that works great:
Several fields in the form but with a radio button that determines where the admin email is to be sent. The radio button is called region.

The items for the region radio button:
region1@nomail.com| Region 1
region2@nomail.com| Region 2

Additional attributes for the region radio button:
onClick='setregion(this);'

I also created a hidden field called regionname that is used to display the actual text of the radio selection in the email.

In the form layout, uncheck the Auto Generate Layout (after you have the form built). Add this javascript code to the form layout (this could be optimized but it's easier to understand this way):
<script type='text/javascript' lang='javascript'>
<!--
  function getLabelText(id) {
    var labels=document.getElementsByTagName("label");
    for( i=0; i<labels.length;i++ ){
      if(labels[i].htmlFor==id) {
        var labelText = labels[i].innerHTML; 
        return labelText;
      }
    }
    return null;
  }
 
  function setregion(field) {
    var labelText = getLabelText(field.id);
    var form = document.getElementById('userForm');
    form.regionname.value = labelText;
    return false;
  }
 
-->
</script>

In the Admin Emails tab, do something like this for the email content:
Thanks for your interest in {regionname:value}.

Set the To: for the admin email to
{region:value}
The administrator has disabled public write access.

Re:Different admin mail to: based on selection 15 years 2 months ago #6629

  • nirvana
  • nirvana's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
Thanks,

I assume this would work with a drop down as well or would something else need to be changed?
The administrator has disabled public write access.

Re:Different admin mail to: based on selection 15 years 2 months ago #6632

Haven't tried it but it should work. Change the onclick javascript event to an onchange event so the text from the selection is saved in the hidden field.
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!