1

I have used Google ReCaptcha in my MVC 4 web application.

i have one view page using two different ReCaptcha but only one is showing.

Huseyin Yagli
  • 9,896
  • 6
  • 41
  • 50
se_msp2012
  • 11
  • 3
  • possible duplicate of [How do I show multiple recaptchas on a single page?](http://stackoverflow.com/questions/1241947/how-do-i-show-multiple-recaptchas-on-a-single-page) – Huseyin Yagli Jan 24 '15 at 15:24

1 Answers1

1

If you look at the HTML code, you will notice that the recaptcha ID is the same for both, which is causing the issue.

I was going to suggest the following:

=============

If you have a page with a modal, you may try using some logic and jQuery to do something like this:

// remove any existing recaptcha elements so we can present another
function removeCaptchaElement() {
    if ($("#recaptcha_widget_div").length == 0) {
        $('#recaptcha_widget_div').remove();
    }
}

This will ensure the there are no other elements on the page when you go to create your new recaptcha instance - kind of messy though.

=============

However this won't work because at the time of page creation, more than one modal control will exist on the page.

Alternately, you could display recaptcha without a plugin, and code accordingly.

You could also grab the source code from here, and add a new initialization parameter that takes in a unique ID value.

You could also just roll your own simple math/text-based captcha with Javascript.

Lastly, you could try this.

ElHaix
  • 12,846
  • 27
  • 115
  • 203