EWZRecaptchaBundle
EWZRecaptchaBundle copied to clipboard
Where to put callback function?
One of those things that seems so obvious it's not documented anywhere...
I have tried placing the callback in FormType.php where the captcha field is configured, in the js code on the page, and in the User entity connected to the form.
No matter where I place it I get an error:
"ReCAPTCHA couldn't find user-provided function: onReCaptchaSuccess"
$builder->add('captcha', EWZRecaptchaType::class, [
'attr' => [
'options' => [
'theme' => 'light',
'type' => 'image',
'size' => 'normal',
'defer' => true,
'async' => true,
'callback' => 'onReCaptchaSuccess', // callback will be set by default if not defined (along with JS function that validate the form on success)
]
],
'mapped' => false,
'constraints' => [new RecaptchaTrue(['groups' => 'Registration'])]
]);