UndefinedOffset / silverstripe-nocaptcha

A spam protector and form field using Google's reCAPTCHA v2 or optionally a foundation v3 implementation
BSD 3-Clause "New" or "Revised" License
31 stars 37 forks source link

Invisible captcha invalid form submission bug #29

Closed 3Dgoo closed 7 years ago

3Dgoo commented 7 years ago

When using the invisible captcha the form submits to the server even when JavaScript validation deems the form to be invalid.

On submission of a form, if the form is invalid and the form submission is blocked by JavaScript the invisible captcha will override this block, submit the form and cause the page to refresh.

To recreate this issue we can create a UserForm with a required text field and an invisible captcha. Without filling in the required text field submit the form. The JavaScript validation will block the form submission and display a requirement error message on the text field. A couple of seconds later the form will submit and the page will refresh.

UndefinedOffset commented 7 years ago

This is very likely related to how the the listener is bound to the form. The listener is required for the invisible captcha because it does not automatically run on form submit, it may just need to be tweaked to account for jQuery validate which I believe userforms is using.

I'll try to find some time to re-work this to address this issue.

UndefinedOffset commented 7 years ago

Give master a try now and let me know if it's still not working, it seems to be for me with the changes in 2da0ab9