Skip to content

grecaptcha validatorFunction fixed #452

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

Merged
merged 3 commits into from
Jun 12, 2016

Conversation

FuzzyBS
Copy link
Contributor

@FuzzyBS FuzzyBS commented Jun 9, 2016

validatorFunction should return a boolean.
grepcaptcha.getResponse() returns a string, so I added !='' to check if string is empty.

Hopefully this will fix it so the submit button stays disabled until user has completed the CAPTCHA otherwise this validator serves no purpose other than to generate the field to submit with the form data.

FuzzyBS added 3 commits June 9, 2016 16:14
validatorFunction should return a boolean. Hopefully this will fix it so the submit button stays disabled until user has completed the CAPTCHA.
@victorjonsson victorjonsson merged commit 8bd0989 into victorjonsson:master Jun 12, 2016
@victorjonsson
Copy link
Owner

Superb!

@wlkns
Copy link

wlkns commented Jun 12, 2016

Thanks @FuzzyBS, this was causing problems for me. I'll give it a go.

@FuzzyBS
Copy link
Contributor Author

FuzzyBS commented Jun 13, 2016

Glad I could contribute. This is my first time contributing on github so any pointers would be appreciated.

I'm thinking we should add a CSS rule to the default theme so it sizes the field the same as the actual CAPTCHA will be with visible text indicating that they need to reload or there was an error (i.e. javascript disabled). This way if the CAPTCHA doesn't load for some reason, or loads late, the user will know why there's an extra field with no label.

Also, the documentation needs to be fixed up. The input field should have the site key, not the ID of the CAPTCHA div (which will be set by the script after it loads). This had me very confused at first. It would also be helpful to show the CAPTCHA in the example at the bottom of the security module page.

<input data-validation="recaptcha" data-validation-recaptcha-sitekey="...">

Hope this helps. Thanks for the feedback. (c:

@FuzzyBS
Copy link
Contributor Author

FuzzyBS commented Jun 13, 2016

@victorjonsson,
Just curious, how long does it usually take before the new version becomes available on CDNJS?

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

Successfully merging this pull request may close these issues.

3 participants