Forums

CF7 send email if condition

crealiagroup 12 Oct, 2020
This is my scenario.

I have a dropdown select field where user can or not select a value.
  1. If user do not select any value, only the main email action will be sent out
  2. If user select value 1 then main email action and email1 action will be executed on form submit
  3. If user select value 2 then main email action and email2 action will be executed on form submit

How to?
Ron 13 Oct, 2020
Hello, crealiagroup,

I think this should not be a problem. Just create an event as per selection and enable or disable the selections as per your desire.
Max_admin 13 Oct, 2020
Answer
1 Likes
Add one email action in the actions area for the main email

Then add 2 actions for emails 1 & 2, control their processing with the "Run Conditions" behavior under the "Data" behaviors section!

You will need to use something like this in the conditions:
{data:select_field_name} = 1 (or 2)
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
wanderschaft 17 Nov, 2020
For a Radio Field your sugestion is great, thx!
BUT, how does ist work with a Checkbox Field with multibple Lines? Can I do something similar like the {data:select_field_name} = 1 (or 2)?
I want to send a Emal for each condition, i tried it with "==" and with "match" but nothing works.
DO you have an Idea?
Max_admin 18 Nov, 2020
you may need 2 condition rules for this:
1 in {data:checkboxes_field_name}
2 in {data:checkboxes_field_name}

and change the "All rules match" to "Any rules match"
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
wanderschaft 18 Nov, 2020
Thx for the Idea! I Tested it out, but I did not find a solution, ...
So what I want is the same as at the Beginning with the Radio Box (which worked perfectly), but with CheckboxES with several Options (not Radio, not Checkbox). The User can choose option 1 oder Option 2 or both. In Checkboxes Field I Did this:
Name checkboxes_test
ck1 ---> Option 1
ck2----> Option 2

In the End_page Section (after the Submit) I insert two Mail Action with run condition in each to grab the Values I did it like you said
{data:checkboxes_test} == ck1

and the second Mail

{data:checkboxes_test} == ck2

(this ist how it worked with Radio)

BUT now with Checkboxes it doesn't work. It sounds normal for me, because the Radio field ist different. I found out that there ist a problem with the comparison operator or with the Call "{data:...} SO I tried comparison operator "IN" and "Match" no result, with "not empty" it will work, but this ist not specific enough for me.....

data: does not grab the correct information because the checkboxes gives back an array like this :

[checkboxes_test] => Array
        (
            [0] => ck1
        )

The Radio Box ist different like this (of course, because checkboxes can have many posibilities, radios just one):
[radiobox_name] => opt1

So what I need ist the correct call to make a correct Comparison, it must be different to {data:checkboxes_test} or do you have an Idea for the correct systax of the comparision in the run condition. I am sure this ist interesseting for all, because not everyone uses radioboxes, sometimes you need checkboxes to send out the correct mail and it is truely a genius Idea to combine sending Emails with run conditions... this makes thins possible like "What Webinar do you want to visit" and you can send entirely different mails with attachements and infos and so on, really great, so maybe we get it working even for checkboxes!
thx so much!
Max_admin 21 Nov, 2020
According to my latest reply, the condition for the email should be in this format:
ck1 IN {data:checkboxes_test}
Does that work ?

you should start the condition with the value, because of the array!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
v.d. Hulst 18 Sep, 2024

Hello,

In CF8 there is no "Run Conditions" in the Behaviors section.

How can that be realised in CF8?

Regards,

Peter

gotpowr 19 Sep, 2024

You would need to use the PHP events behavior.  Here's a link with more info.

In short, you create a PHP action, and enter an event (which I'm assuming the name must match the return value from the PHP statement)

When you save it rebuilds with the name of the event as a section you can drop whatever you need in.

https://www.chronoengine.com/forums/topics/view/111228/cf8-run-conditions-for-actions

I haven't used this myself yet, but I'm starting to look at what I would need to do to move from CF7 to CF8.

You need to login to be able to post a reply.