Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm using the colorbox module to create a modal frame that pops up with the user registration form. Unfortunately the reCaptcha form isn't rendered in the colorbox. I get the fieldset and description that I assume reCaptcha generates but a empty
for the form itself:
<div id="recaptcha_ajax_api_container"></div>
I can get the full form to show when using the default Math captcha so I don't think its a colorbox or Captcha issue. It seems to be localized to reCaptcha. I can provide additional information if needed. Any help is appreciated.
Comment | File | Size | Author |
---|---|---|---|
#18 | recaptcha_ajax_1119086.patch | 547 bytes | Liam Morland |
Comments
Comment #1
dshumaker CreditAttribution: dshumaker commentedThis might be of help to someone here:
http://stackoverflow.com/questions/2124783/recaptcha-ajax-api-not-workin...
..
I'm also having a similar issue but with Lightbox2 and recaptcha not showing up.
Comment #2
Liam MorlandCan you provide a set of steps to reproduce the problem?
Does the problem exist with the development version of reCAPTCHA?
Comment #3
Liam MorlandPresuming problem has been solved.
Comment #4
richH CreditAttribution: richH commentedHi,
sorry to re-open this, but I'm experiencing this on a pretty clean installation of D7. I'm using
reCaptcha 7.x-1.7+13-dev (from today)
Captcha 7.x-1.0-beta2
Colorbox Node 7.x-2.4
and I have the problem as described here. I have added a reCaptcha to my site-wide contact form. When I view the page, the reCaptcha appears. When I view the page in a colorbox node, I only get the text:
Thanks
Rich
Comment #5
Liam MorlandIt sounds looks more like the problem is in the Colorbox Node module. The comment in #1 points that way. If the solution linked there works, then Colorbox Node should do something like that for any content that would exhibit the problem. If there is something that needs to be changed about reCAPTCHA to get this to work, I will monitor this issue.
You might also try the latest dev versions of each of the modules, in case it has been fixed.
Comment #6
richH CreditAttribution: richH commentedHi Liam,
thanks for the quick answer. I just tested the modal window using the math captcha and that is shown ok.
I read the post in #1, but didn't understand what that code is supposed to be changed/entered. It was all a bit cryptic. I'll dig around some more, but if you could help me out with understanding the post in #1 I'd be grateful.
Cheers
Rich
Comment #7
iLLin CreditAttribution: iLLin commentedDoes re-captcha use attach behaviors? If it only uses document.ready then utilizing a timeout will allow it enough time to render.
Comment #8
Liam MorlandIt does not use attach behaviors, but there is a ticket about that: #1258910: Move to Drupal.behavior & Drupal.settings. I may have time to give that a try, but I don't use Colorbox Node, so I can't test it.
Comment #9
Liam MorlandTry the latest development version of reCAPTCHA. I have fixed #1258910: Move to Drupal.behavior & Drupal.settings.
Comment #10
richH CreditAttribution: richH commentedHi,
I took the latest DEV version of reCaptcha for a test drive and have the effect that with reCaptcha activated the colorbox-node doesn't even open. The throbber turns and then nothing. If I set the captcha to "image" it all works ok again
Sorry for bad news :-(
Colorbox Node
7.x-2.4+1-dev
CAPTCHA
7.x-1.0-beta2
reCAPTCHA
7.x-1.8-rc1+1-dev
Cheers
Rich
Comment #11
Liam MorlandIn admin/config/people/captcha/recaptcha, are you checking the checkbox "AJAX API"?
Comment #12
richH CreditAttribution: richH commentedHi,
yes, with the Ajax box checked the colorbox overlay doesn't appear at all. But unfortunately, without the Ajax box, the overlay appears, but not the captcha widget (just the text as described above).
Cheers
Rich
Comment #13
Liam MorlandOK, there are probably some JavaScript errors on your browser's error console which will point towards the problem.
Comment #14
richH CreditAttribution: richH commentedHi,
this is the output with the Ajax box checked:
Cheers
Rich
Comment #15
iLLin CreditAttribution: iLLin commentedComment #16
Liam MorlandTry again with the latest development version. It may have been fixed with #1827922: Always use HTTPS to communicate with reCAPTCHA servers.
Comment #17
jockium CreditAttribution: jockium commentedI have been having the exact same problems described above, with implementing reCaptcha on a modal popup using the "ajax-register" module. Originally the image would not load. ever. I installed the Dec-7 dev version per your suggestions, and the new situation is this:
(not using the Ajax API): it still does not work.
(using the Ajax API) MOST of the time, the javascript breaks the popup, with a message
a small number of times, it actually worked!
I started looking into this, and to me, this appears to be a "race" condition, where the module's recaptcha.js file gets loaded and executed before the api download from google...
I have validated this using HTTP-Fox
e.g.:
4.003 + .387 = 4.390 (recaptcha API ready time)
4.275 + .050 = 4.325 (module's js executed, before we downloaded the whole API file from google!)
Result: Broken window
5.869 + .439 = 6.308 (recaptcha API ready time)
6.198 + .162 = 6.360 (module's js executed, AFTER we downloaded the whole API file from google!)
Result: Working reCAPTCHA!
Any ideas on how we might force the module's javascript to wait for the rest of the javascript files to load?
Thanks!
Comment #18
Liam MorlandTry this patch. This patch puts the call to Recaptcha.create() as a $(document).ready() call. I thought that Drupal.behaviors took care of that, but perhaps this will work.
Comment #19
jockium CreditAttribution: jockium commentedThank you very much, the patch on #18 worked like a charm!
99.9% of the times, it worked perfectly. Until I can actually reproduce and monitor that 1 time that it didn't work, I consider this problem solved.
I guess the Drupal.behaviors is concerned only with local/inline scripts, and not external ones...
Thanks again!
Comment #20
Liam MorlandFixed in d0e0a06.
Comment #21
Liam MorlandComment #22
bjsomers CreditAttribution: bjsomers commentedHi Liam,
I'd like to apply your patch from #18, but I'm not finding the recaptcha.js file anywhere in the module files. Could you please explain how to manually apply this patch?
Thanks,
Brian
Comment #23
Liam MorlandIt's not in 7.x-1.8 The file was created by #1258910: Move to Drupal.behavior & Drupal.settings. Use the development version to get both patches. I will tag a release soon.
Comment #27
hass CreditAttribution: hass commentedJS code does not exist in D6.
Comment #29
jenniferklibby CreditAttribution: jenniferklibby commentedI am having this exact same issue. I am using version 7.x-2.2. Has the resolution in the patch from 6 years ago still not been applied to the updated module??
Comment #30
scott.browne CreditAttribution: scott.browne commentedLooks like this is still broken in both current and dev for D7. Any update on a fix?