6

It is possible to add multiple reCAPTCHAS in one form? I tried doing so, even giving the multiple reCAPTCHAS different IDs, but when I load the page in the browser, only one of them is shown.

Is this by design? I need the two reCAPTCHAS because one is for Login, and the other one is for the Register form, which will be shown on the same page.

Thanks! WT

Donnie Thomas
  • 3,888
  • 8
  • 47
  • 70

6 Answers6

3

Only one Cpatcha is supported in a page at any time. What you can do is use AJAX and lod captcha after the form is loaded.

This might of some help.

Shoban
  • 22,920
  • 8
  • 63
  • 107
  • 1
    Thanks Shoban for mentioning this. It just saved my day. I had captcha images in two different update panels i.e. two captcha on same page. Interestingly captcha in one update panel was refreshed when a button is submit but another captcha was not changing after button click. So what I did was on EndRequest I called the refreshcaptcha function and it did the trick. – user1254053 Oct 30 '14 at 13:08
1

After a quick google search, it appears that it's not currently possible. One suggestion I saw was to pop up a modal recaptcha just as the user submits the form. ondemandcaptcha for Ruby.

Greg
  • 16,540
  • 9
  • 51
  • 97
1

I was initially lead by this thread to believe there is no simple answer, but after digging through the Recaptcha ajax library I can tell you this isn't true! TLDR, working jsfiddle: http://jsfiddle.net/Vanit/Qu6kn/

It's possible to overwrite the Recaptcha callbacks to do whatever you want with the challenge. You don't even need a proxy div because with the overwrites the DOM code won't execute. Call Recaptcha.reload() whenever you want to trigger the callbacks again.

function doSomething(challenge){
    $(':input[name=recaptcha_challenge_field]').val(challenge);
    $('img.recaptcha').attr('src', '//www.google.com/recaptcha/api/image?c='+challenge);
}

//Called on Recaptcha.reload()
Recaptcha.finish_reload = function(challenge,b,c){
    doSomething(challenge);
}

//Called on page load
Recaptcha.challenge_callback = function(){
    doSomething(RecaptchaState.challenge)
}

Recaptcha.create("YOUR_PUBLIC_KEY");
Vanit
  • 11
  • 1
1

It is now possible to do this easily with explicit recaptcha creation. See my answer here:

How do I show multiple recaptchas on a single page?

Community
  • 1
  • 1
Huseyin Yagli
  • 9,896
  • 6
  • 41
  • 50
0

It's not too difficult to load each Recaptcha only when needed using the Recaptcha AJAX API, see my post here:

How do I show multiple recaptchas on a single page?

Community
  • 1
  • 1
siliconrockstar
  • 3,554
  • 36
  • 33
0

the captcha has an img element #recaptcha_challenge_image element , so after you set the recaptcha in one div say "regCaptch",get that img src attr ,set your other captcha div html to the old one html and then set the #recaptcha_challenge_image src to the src you get , here is a working example

    var reCaptcha_src = $('#recaptcha_challenge_image').attr('src');
    $('#texo').html($('#regCaptch').html());
    $('#recaptcha_challenge_image').attr('src',reCaptcha_src);