sent mail

Conditionally send an email based on a form field selection.

Overview

ChronoForms v8 lacked a direct "Run Conditions" feature to check a user's email preference before sending.
Use a PHP action with the Events behavior to return the field value, then attach the Email action to the appropriate event (like "Yes") to control when the email is sent.

Answered
ChronoForms v8
Pk Pkoll 07 Nov, 2024

Hi Max

In the view of my form I have defined a field within a user can indicate wether he wants to receive a mail Yes of No. 

Is there a way in CF 8 tin de submit area to check  to send a mail or not. There is no trigger or event in a mailobject.

So how can I do that?

greetings 

Paul

Max_admin Max_admin 07 Nov, 2024
Answer

Hi Paul

v8 does not have a Run Conditions behavior like v7 yet, so the way to do this now is using PHP action with Events behavior, you need to return the field value and add 2 events Yes & No to match the returned values (or Yes only for simplicity) and drag your Email action there

return $this->data("field_name"); // this will return either Yes or No
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Pk Pkoll 09 Nov, 2024

Thanks Max

It works

Paul

Max_admin Max_admin 09 Nov, 2024

No problem, I have also added a Run Conditions behavior to the new update

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.