Event switcher in PHP 8?

How to use the event switcher in ChronoForms 8 for custom validation like hCaptcha.

Overview

The problem is that the event switcher interface and functionality changed significantly from previous CF versions, making it unclear how to replicate custom validation logic.
Set the variable you need to switch on, define the values to check, and configure the outcomes to continue or stop processing. Refer to the official tutorial for detailed, step-by-step guidance.

Answered
ChronoForms v8
yu yuziweb 20 Jan, 2025

Hello,

I need to migrate to 8, no problem, but where is the Event Swticher?

Because Recaptcha doesnt work for me I need to implement hcaptcha because that works better for me, in all previous CF versions, way less spam. But I miss the Event Switcher. 

Can you tell me how I can add the same functionality. For example I did this in previous versions:

<?php


$data = array(
            'secret' => "SECRECTCODE",
            'response' => $_POST['h-captcha-response']
        );

die();
if($name == '' OR $email == '' OR $bericht == ''){
  return "fail";
}

$verify = curl_init();
curl_setopt($verify, CURLOPT_URL, "https://hcaptcha.com/siteverify");
curl_setopt($verify, CURLOPT_POST, true);
curl_setopt($verify, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($verify, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($verify);
// var_dump($response);
$responseData = json_decode($response);
if($responseData->success) {
   return "success";
} 
else {
    return "fail";
}
?>

So I can let the flow continue with success or return fail so I can stop the processing and not send email and save the data. But that is missing in 8. Can you explain how I get the same functionality?

Max_admin Max_admin 20 Jan, 2025
Answer

Event switcher in PHP 8? image 1

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
yu yuziweb 20 Jan, 2025

Ok thanks but now the event switcher is way different than in previous versions. Can you please explain how I can setup the exact same functionality in this new event swticher?

Also why is every version reinventing the wheel? It's getting quite annoying 😅

Max_admin Max_admin 20 Jan, 2025

We do not reinvent the wheel, but the interface may change based on users requests

the use is straight forward, set the variable you need to switch, define the values you want to check, here is a quick tutorial

https://www.chronoengine.com/faqs/chronoforms/chronoforms8/how-to-use-the-event-switcher-in-chronoforms-8

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.