Check whether the reCaptcha is filled or not before the form is send

2,514 views
Skip to first unread message

Marco Lütticke

unread,
Dec 8, 2014, 6:07:01 AM12/8/14
to reca...@googlegroups.com
Hello.

Is it possible to check whether the reCaptcha is filled or not before the form is send with javascript??


Marco Lütticke

unread,
Dec 8, 2014, 6:51:11 AM12/8/14
to reca...@googlegroups.com
I tried it with:

        <script type="text/javascript">
        function validateForm () {
            if (document.Formular.g-recaptcha-response.value == "") {
                alert("Bitte Sicherheitsfrage beantworten!");
                return false;
            }
        }
        </script>

but nothing happens...

Marco Lütticke

unread,
Dec 9, 2014, 8:32:13 AM12/9/14
to reca...@googlegroups.com
please help me!!!


Am Montag, 8. Dezember 2014 12:07:01 UTC+1 schrieb Marco Lütticke:

Keely

unread,
Dec 10, 2014, 1:16:01 PM12/10/14
to reca...@googlegroups.com

Marco Lütticke

unread,
Dec 19, 2014, 9:00:55 AM12/19/14
to reca...@googlegroups.com
The captcha is working. But I want to check whether the captcha is checked or not when I press the submit button so i can cancel submiting the form without leaving it.

I tried it with the javascript i posted above but it doesn´t work.



Am Montag, 8. Dezember 2014 12:07:01 UTC+1 schrieb Marco Lütticke:
Message has been deleted

kh99

unread,
Dec 19, 2014, 2:18:06 PM12/19/14
to reca...@googlegroups.com
Maybe try calling grecaptcha.getResponse() and checking if the string is empty or not.

Marco Lütticke

unread,
Dec 22, 2014, 3:53:01 AM12/22/14
to reca...@googlegroups.com
Thanks a lot. Works great.
Reply all
Reply to author
Forward
0 new messages