15
Views
1
Comments
[Cloudflare Captcha React] Handle callbacks
cloudflare-captcha-react
Reactive icon
Forge asset by Pragati Patidar
Application Type
Reactive

Hi,

does anyone have a clue how to handle the callbacks from Cloudflare (data-callback, data-error-callback).

The only way I can get a callback triggered is by addint javascript to the Scripts section and add it to the Required Scripts of the page. 

The problem is, that I cannot use '$actions' this way as it is a global javascript.

When adding the function directly in the page's OnReady using the Javascript node it will not be triggered...

The javascript code I use is as shown below:

function onTurnstileSuccess(token) {
    console.log("Home - Turnstile success:", token);
    // $actions.Turnstile_OnSuccess();
}

2023-10-16 05-50-48
Shingo Lam

Hi @Rob Poels ,

In my opinion, the $action can only be defined in client action / screen action. I recommend you create an client action (let say "Turnstile_OnSuccess_Wrapper") where it will include the javascript code to call the Turnstile_OnSuccess in your Home.js

Hope this help

Thanks and best regards.

Shingo

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.