problems with API AJAX multiple CAPTCHA one FORM

5,321 views
Skip to first unread message

juanpcastelli

unread,
Apr 15, 2009, 8:26:19 AM4/15/09
to reCAPTCHA
Hi, Ive some trouble when customizing multiples Recaptcha on a
template. Here's the code:

<script type="text/javascript" src="http://api.recaptcha.net/js/
recaptcha_ajax.js"></script>

<script>
function showRecaptcha(element, themeName) {
Recaptcha.create("------------------------------", element, {
theme: themeName,
tabindex: 0,
callback: Recaptcha.focus_response_field
});
}

function destroyRecaptchaWidget() {
Recaptcha.destroy();
}

</script>

<TD style="background: #F2F2F2" align="left">&nbsp;&nbsp;<a href=""
onclick="showRecaptcha('dynamic_recaptcha_1', 'custom');"
class="linkGrisRojo">link</a></TD>

The problem is that only displays well one recaptcha customized,
others recaptcha image doesnt show image.

Much Thanks,

reCAPTCHA Support

unread,
Apr 15, 2009, 11:48:50 AM4/15/09
to reca...@googlegroups.com
Hi,

Only one CAPTCHA is supported on the page at any time.

- Ben
--
reCAPTCHA: stop spam, read books
http://recaptcha.net

juanpcastelli

unread,
Apr 15, 2009, 12:18:35 PM4/15/09
to reCAPTCHA
I know, but im showing just one captcha at time.

Daniel

unread,
Apr 15, 2009, 1:37:51 PM4/15/09
to reCAPTCHA
Even if you don't show them, if they render by the browser, it won't
work. I had this problem before, and the solution I went with was to
create a popup window for each instance of the add a comment. That
worked well in terms of UX and using reCaptcha.

Dan

juanpcastelli

unread,
Apr 16, 2009, 7:40:53 AM4/16/09
to reCAPTCHA

I could resolv the problem by using parentNod.

The template:

<div id="recaptcha" style="display:none">
<div id="recaptcha_widget" align="center">
<div id="recaptcha_image"></div>
<div><a href="javascript:Recaptcha.reload()">Cambiar
Imagen</a></div>
<div>Ingrese los caracteres de la imagen:</div>
<div><input type="text" id="recaptcha_response_field"
name="recaptcha_response_field" /></div> </div>
<script type="text/javascript" src="http://api.recaptcha.net/
challenge?k=KEY&lang=es"></script>
</div>

And the Javascript:

var ptro_rw = document.getElementById('recaptcha_widget');
var padre = ptro_rw.parentNode;
var div_recaptcha = padre.firstChild;
var id_nuevo_div = 'recaptcha_'+ formActual;
var nuevo_div = document.getElementById(id_nuevo_div);
nuevo_div.appendChild(div_recaptcha);
Recaptcha.reload();

In the Js i cut the div id=recaptcha_widget and paste it in the area
we want to be shown. I hope it's useful.

Much Thanks for the answers,

Jei
Reply all
Reply to author
Forward
0 new messages