Forums

Conditional Field Email Redirection

diabolka 05 Jan, 2015
I am trying to set up some sort of conditional formatting on a form on our website so that if someone requests information about a specific answer to a field, the request form gets forwarded to one e-mail address but the rest of the answers in the field would go to another email address.

How can I go about doing this? Please advise. Thanks in advance.
GreyHead 06 Jan, 2015
Hi diabolka,

You can possibly set this up with an Event Switcher action. That would let you send the email to different addresses.

Bob
diabolka 06 Jan, 2015
I apologize for my ignorance but what is an Event Switcher action? Where do I find documentation on this? Thanks.
BNDragon 07 Jan, 2015
Hi

You can take a look at this post to understand how it works. This case is for two submit buttons, but you can adapt it to your needs.

You can find the Event Switcher Action in Setup Tab under Validation.

Explain a little, the Event Switcher let you set some conditions to make some kind of action. For example, I use an Event switcher to know if my user is login or register, so I created the conditions and if the user click my Login Button then go to Joomla Login Action, and if he click on my Register Button it go Joomla Registration Action.

To help more, in case you need, tell us how the user requests the information.

BN
BNDragon 07 Jan, 2015
Hi there,

Sorry, I didn't note your versions, so I don't know if what I said can be applied, so, it's better to see the Bob post.

BN
diabolka 07 Jan, 2015
Thank you both for your patience. How do I install these files? where?

This is for a Request Info form. The field program has multiple options, but the end result needs to be:

If they choose Online Program, the email should go to online@domain.com

If they choose any of the other 7 options, the email should go to traditional@domain.com

Does that make sense?
diabolka 07 Jan, 2015
Chronoforms V4 RC3.0 / System: J! 2.5
BNDragon 07 Jan, 2015
Hi diabolka,

It's the full email? Or just a part of it? In your first post it looks like you want to send just part of your form.

You can donwload the actions in the links that Bob posted. To install is easy, just go to CF in backend and in top you'll see an install actions button๐Ÿ˜‰

I used some actions from Bob([GH]) when I used CF4, it's kind easy to use it. But if you need some help, just say. Bob will help you for certain, and I can install it to help you too๐Ÿ™‚

BN
diabolka 07 Jan, 2015
I did not see that button. It's been a long week so thank you!

The full form will go to either address. There are two addresses for the two different departments so if online program is picked, the results will be sent to the online email address. If any of the other selections in program is picked, the form results go to the other email address. That's the only difference.
BNDragon 07 Jan, 2015
Hi diabolka,
Tha's sound "easy" work.

First, to install, in your back-end you should see some like this (I'm using J3, but I believe that is not much different than J2.5)
[attachment=0]cf install action.png[/attachment]

When you install it we can take care of the Setup Tab.

BN
diabolka 07 Jan, 2015
I installed Email GH, Event Switcher and the if_then_else action. No errors.
BNDragon 07 Jan, 2015
I forgot how superb the [GH] actions are.

For your needs, I believe that you only need the Email Action.
It have a Field in his configuration where you can put a condition.

Heres a ie.
I created a radio box with 2 options, and give the values :
0=NO
1=Yes


In [GH]Email action I just put this condition:
{radioValue}::1

(Note: radioValue is the field name)
And when the user pick yes radio, send an email if he pick No, it does nothing.

So Just need to set 2 [GH]Email action.
I don't know if you need just 2 or more with this solution.

Bob, this
{radioValue}::1
is for when the
radioValue==1
how to make the condition negative, like
radioValue!=1
?

If this is not possible, the best solution will be the Event Switcher action.

BN
diabolka 07 Jan, 2015
I don't think that will work because if
{radioValue}::online it needs to send email to online@
{radioValue}::<all others> it needs to send to traditional@

I can't have it not send. Am I misunderstanding?
BNDragon 08 Jan, 2015
Hi diabolka,

My idea was have to email actions, where one have {radioValue}::online condition and the other {radioValue}::"<all others> " condition.

Your email would always be send. The problem where is that I don't know how to make {radioValue}::"<all others> " condition.

So I suggest the event switch, you just need to create a condition like
if({radioValue}::online)
return A;
Else
return B;


Where in Event A you send the email to online@ and in other cases you send to traditional@.

I never used the event switcher on CF4 so I can't tell you how it work, so wait a little for Bob, He will help you create the condition.

BN
diabolka 08 Jan, 2015
Ok, thank you. I appreciate your help.
diabolka 12 Jan, 2015
Am I looking to do something like:

<?php

if ({program} == 'Online') {
{temail} == 'email1@domain.com' ;
else {
{temail} == 'email2@domain.com' ;
}
?>

How do I set it up so it knows the {program} and {temail} are the field names?
diabolka 12 Jan, 2015
Am I looking to do something like in the if_else GH action:

if ({program} == 'Online') {     
   {temail} == 'email1@domain.com' ;
else {    
 {temail} == 'email2@domain.com' ;
}

How do I set it up so it knows the {program} and {temail} are the field names? Right now, it just takes program as the answer whereas I want the answer to be 'Online'.


The debug info says:
expression before:
     expression: if ({program} == 'Online') { ({temail} == 'email1@domain.com') ; else { ({temail} == 'email2@domain.com') ; }

expression after:
    expression: if (Business == 'Online') { ( == 'email1@domain.com') ; else { ( == 'email2@domain.com') ; }

expression Result:
     expression Result: false
diabolka 12 Jan, 2015
I have this:

if ([program] == 'Online') {
    ([temail] == 'diane.brunsting@trnty.edu') ; 
else {
    ([temail] == 'dy@dragonlands.com') ; }



But the debug info is saying this


expression before:
    expression: if ([program] == 'Online') { ([temail] == 'diane.brunsting@trnty.edu') ; else { ([temail] == 'dy@dragonlands.com') ; }

expression after:
    expression: if ([program] == 'Online') { ([temail] == 'diane.brunsting@trnty.edu') ; else { ([temail] == 'dy@dragonlands.com') ; }

expression Result:
    expression Result: false



It shouldn't be false. What am I missing??? Thanks in advance
diabolka 12 Jan, 2015
My apologies for the extra posts. I thought I was editing.
diabolka 12 Jan, 2015
I have this set up as an if-else GH action event:

if ([program] == 'Online') {
    ([temail] == 'diane.brunsting@trnty.edu') ; 
else {
    ([temail] == 'dy@dragonlands.com') ; }



But the debug info is saying this


expression before:
    expression: if ([program] == 'Online') { ([temail] == 'diane.brunsting@trnty.edu') ; else { ([temail] == 'dy@dragonlands.com') ; }

expression after:
    expression: if ([program] == 'Online') { ([temail] == 'diane.brunsting@trnty.edu') ; else { ([temail] == 'dy@dragonlands.com') ; }

expression Result:
    expression Result: false



It shouldn't be false. What am I missing??? I'm not sure why it is not seeing it as the second email. Thanks in advance[/quote]
diabolka 12 Jan, 2015
Answer
Thanks for all your help. Figured it out.๐Ÿ˜€
BNDragon 13 Jan, 2015
Hi diabolka,

Sorry not answer you, but I didn't saw the email warning your topic responses.

I'm glad that you figure it out๐Ÿ™‚

BN
This topic is locked and no more replies can be posted.