Google iFrame not displaying in a custom theme

Created on 20 June 2020, about 5 years ago
Updated 13 June 2025, 19 days ago

We have ReCaptcha configured, but it is not displaying reCaptcha ("I am not a Robot") on any form. We are using a custom build theme. However, when we switch to another theme, Garland for example, reCaptcha displays as expected (which rules out quite a few things!).

In our custom theme, anything related to the Google iFrame is not displaying within the expected div tag. And the form submission fails, as reCaptcha is not validated.

We've been troubleshooting this back and forth, but can't put our finger on a source of the issue. There is nothing in the PHP error logs. What are we missing? Thanks!

We have a test form set up:
https://lurssenmastering.com/test-form-2

Custom theme output:

<fieldset class="captcha form-wrapper"><legend><span class="fieldset-legend">CAPTCHA</span></legend><div class="fieldset-wrapper"><div class="fieldset-description">This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.</div><input type="hidden" name="captcha_sid" value="123100">
  <input type="hidden" name="captcha_token" value="f1e839d0db7d011036f5f4d50f7732e5">
  <input type="hidden" name="captcha_response" value="Google no captcha">
  <div class="g-recaptcha" data-sitekey="6LdbLqUZAAAAALnYDZjPbX-6YROH7O8QP4bamu8P" data-theme="light" data-type="image" data-tabindex="1">
   </div>
   <input type="hidden" name="captcha_cacheable" value="1"></div>
</fieldset>

Garland theme output:

<fieldset class="captcha form-wrapper"><legend><span class="fieldset-legend">CAPTCHA</span></legend><div class="fieldset-wrapper"><div class="fieldset-description">This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.</div><input type="hidden" name="captcha_sid" value="123101">
<input type="hidden" name="captcha_token" value="462d3eb7c198a3d753578c824a7183b8">
<input type="hidden" name="captcha_response" value="Google no captcha">
   <div class="g-recaptcha" data-sitekey="6LdbLqUZAAAAALnYDZjPbX-6YROH7O8QP4bamu8P" data-theme="light" data-type="image" data-tabindex="1">
	<div style="width: 304px; height: 78px;"><div>
		<iframe src="https://www.google.com/recaptcha/api2/anchor?ar=1&amp;k=6LdbLqUZAAAAALnYDZjPbX-6YROH7O8QP4bamu8P&amp;co=aHR0cHM6Ly9sdXJzc2VubWFzdGVyaW5nLmNvbTo0NDM.&amp;hl=en&amp;type=image&amp;v=oqtdXEs9TE9ZUAIhXNz5JBt_&amp;theme=light&amp;size=normal&amp;cb=l266r6ifba1n" width="304" height="78" role="presentation" name="a-ipz2xvraiun5" frameborder="0" scrolling="no" sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-top-navigation allow-modals allow-popups-to-escape-sandbox"></iframe></div><textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 40px; border: 1px solid rgb(193, 193, 193); margin: 10px 25px; padding: 0px; resize: none; display: none;"></textarea></div><iframe style="display: none;"></iframe>
	</div><input type="hidden" name="captcha_cacheable" value="1"></div>
</fieldset>
🐛 Bug report
Status

Closed: outdated

Version

2.0

Component

reCAPTCHA V2

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024