• 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: [Solved] Send Admin emails to diff users by cookie

[Solved] Send Admin emails to diff users by cookie 12 years 2 months ago #21662

Hi There,

I am very new to RS Forms pro and am looking for some assistance to see how I might try and do something with it. I am able to use the basics of RS Forms, however would appreciate some pointers of the best way I might aproach someting a little more complex. I am guessing I need to use scripting, but any hints on the most efficient way to do it would be wonderful.

I have a site which is 'sort of' a multi site, however all the sub sites are contained under the one domain, and certain elements of the site are controlled by session cookies using Chameleon and other tools.

What I would like to do - is for example have one form eg: "Enquiry Form" that when a form is submitted, sends one email to a main/admin address, and then depending on the value of a cookie, send a second email to a varying address.

For example:

if cookie = 'city1' send email to This e-mail address is being protected from spambots. You need JavaScript enabled to view it and This e-mail address is being protected from spambots. You need JavaScript enabled to view it
if cookie = 'city2' send email to This e-mail address is being protected from spambots. You need JavaScript enabled to view it and This e-mail address is being protected from spambots. You need JavaScript enabled to view it

In the interests of disclosure and hopefully the best advice :), I actually have 18 different 'citys'... and it will likely be more in the future.

After looking through RS Forms and reading some vaguely related forum posts, I am not sure if I should try writing the cookie value to a hidden value on form submission and then ... ??? Maybe do something with the that value afterwards....

My other thought was maybe to do cookie check, and 'convert' that to an email address in the php scripts section, and write that to a field value, then add the eg: {cookieemailaddress] to the form properties admin email section?

My problem is that I am not really sure where to start and I don't really understand when certain things are fired, what I can and cant do with PHP or JS etc, and I am hoping that someone might be able to at least point me in the right direction so I don't waste a large amount of time on the wrong road.

Any thoughts or suggestions would be greatly appreciated.

Many thanks in advance.
Last Edit: 12 years 2 months ago by status101.
The administrator has disabled public write access.

Send Admin emails to different users by cookie 12 years 2 months ago #21688

  • octavian
  • octavian's Avatar
  • NOW ONLINE
  • RSJoomla! Official Staff
  • Posts: 783
  • Thank you received: 110
You can always add a script in the "Scripts called on form process" area (Properties > PHP Scripts):
if (!$invalid) { // this checks if the validation passed
	if ($condition_of_cookie) { // this is your cookie handling logic
		$_POST['form']['your_hidden_email_field'] = 'email1@domain.com'; // this sets the hidden field's value to the needed email address
	}
}

You'll of course need to add a hidden field named "your_hidden_email_field" on your form and set the "To" value of your email to be {your_hidden_email_field:value}
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

[Solved] Send Admin emails to diff users by cookie 12 years 2 months ago #21739

Hi octavian

Thank you so much for this! That got me started and finished :)

I ended up with a nice long if/elseif - that so far seems to be working. I have yet to do full testing but initial tests with just 2 or 3 checks of the cookie and sets of the email address is working perfectly, so if there are any problems, it will be with my php :)- your general process was exactly what I was looking for, and when I looked into it more actually helped me gain a better understanding of the way that RSForms works. So much is possible now :)

Great assistance and thank you again.
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!