ReCaptcha not rendered after Ajax-submit with incomplete form
- 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.