Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where to put callback function? #244

Open
rnbwspctrm opened this issue Jun 13, 2020 · 0 comments
Open

Where to put callback function? #244

rnbwspctrm opened this issue Jun 13, 2020 · 0 comments

Comments

@rnbwspctrm
Copy link

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'])]
    ]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant