On my comment form, me reCAPTCHA isn't displaying. It appears that the div containing the reCAPTCHA is empty:
<div id="recaptcha_widget_div" style="display:none"></div>
I am adding to the comment form in hook_form_alter as:
$form['recaptcha_element'] = array(
"#type" => "captcha",
"#captcha_type" => "recaptcha/reCAPTCHA",
"#prefix" => "<strong>Please enter the two words shown below:</strong>",
);
I have another form on the same site where reCAPTCHA is displaying and working correctly. It is a custom form, but is adding the reCAPTCHA element the same way.
Anyone have any idea what might be going wrong, or some suggestions about a good approach to debugging this issue?
Thanks.
Comments
Comment #1
colin_young commentedI forgot to add that my prefix is appearing, although that might have been clear from the fact that I'm getting an empty div that is supposed to hold the reCAPTCHA element.
Comment #2
atorockio commentedHi, I am having a similar problem, my custom theme works great on some forms, including the user login form and a webform form. It doesn't work on the comment form although the pre-built themes do. The CAPTCHA div is there but it's empty.
I also get a javascript error:
a("recaptcha_response_field") is null
https://www.google.com/recaptcha/api/js/recaptcha_ajax.js line 19
I guess that makes sense since the form elements are not there.
Colin, did you find a solution to your problem? Or can anyone else help?
BTW, I am using the 6.x-1.7 version of ReCaptcha module.
Thanks for any help in advance.
Comment #3
sherick commentedreCAPTCHA doesn't work on second form. recaptcha_widget_div is empty. Issue still exists at 7.x-1.9 version.
Comment #4
liam morlandWhat do you mean by "second form"? Does the Math CAPTCHA work? Please try the latest development version of reCAPTCHA.
Comment #5
liam morlandTry the latest development version. If you are still having problems, please re-open and provide steps to reproduce the problem.
Comment #6
bassplaya commented@Liam I think this is the problem that @Rossoneri is experiencing:
When you use the module "login toboggan" you can have the option to tick this box which will present both forms on the same page but will hide or show them through CSS (and jQuery?). Thus "2 forms on one page". The Captcha will show for first form but will be hidden for the second form.
A quick and dirty solution is to give one form (in this case for example the login-form) another kind of Captcha like the math captcha and use reCaptcha for the second form (register). That should work without altering the CSS code.