← Back to Flexi Contact Support
My goal is to use the Alxy.Captcha plugin with a simple contact form managed by Flexi Contact.
I began by getting a basic Flexi Contact form working and verified I received mail as a result of submitting the form.
Then, I read that in order to use Alxy.Captcha I had to integrate its component markup inside the form elements so I copied Flexi Contact's markup from here:
components/contactform/default.htm
into my own contact page markup and then placed the Alxy.Captcha component with the form elements. I verified that the page renders as I would expect. The Captcha is at the bottom of the form. I can click on the captcha and the checkbox appears, so that script is loading from Google and working.
But when I click submit on the form the form is reloaded and the email is not sent (meaning the form, even if it was submitted, is failing validation). If I understand the architecture correctly the problem is the captcha handler isn't being called, so the solution should be to figure out how to call that from within onMailSubmit, yet I'm still confused on how to do that. If this were standard Laravel I'd "use" whatever class I needed, which would be autoloaded, and then call the function.
Yet I'm not 100% sure that will work because the Alxy.Captcha handler calls a closure to handle the "next" handler (?) I'm not sure what that does exactly. It may not do what I think.
Anyone have any ideas as to whether I'm on the right path here?
I'm also getting blank page but only if captcha is invalid. Captcha success working fine. I'm using sweetAlert for flash. I resolved this by adding flash in Alxy.Captcha code which is not good idea, but it worked for me.
/**
* Fail, if the response isn't OK
*/
if (! $response->isSuccess()) {
if ($request->ajax()) {
Flash::error( "reCaptcha Vilidation failed!" );// I've added this here!
throw new AjaxException( $response->getErrorCodes() );
} else {
foreach ($response->getErrorCodes() as $code) {
Flash::error( $code );
}
return redirect()->back()->withInput();
}
}
You can also check what response you are getting in Chrome Developer tools Network tab.
Last updated
1-2 of 2