bolt / bolt/boltforms

ReCaptcha not rendered after Ajax-submit with incomplete form

Open
#117 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
PHP
Stars
52
Forks
54
PR merge metrics
No merged PRs in 30d

Description

I'm currently using the master branch of BoltForms because I need the Ajax submit functionality.
When the form is not completed or does not pass validity checks, the form is rerendered, but the ReCaptcha is not. I have tried to solve this by appending this to the success function of the postForm function (in _ajax.twig):
```
var captchas = $('.g-recaptcha');
for (var i = 0; i < captchas.length; i++) {
var c = captchas[i];
grecaptcha.render(c, {'sitekey': $(c).data('sitekey')});
}
```
This is of course not the most elegant solution, since the Recaptcha is also re-initialized when it was "checked" successfully, but one of the other fields were not (so it has to be re-checked again). I can't come up with another another solution without dissecting the entire BoltForms source code (which is mostly uncharted territory for me ;), so some help will be appreciated!
Thanks in advance!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.