Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Caldera Forms Anti Spam ReCAPTCHA did not show on normal form #2

Open
alucard001 opened this issue Nov 17, 2017 · 10 comments
Open

Caldera Forms Anti Spam ReCAPTCHA did not show on normal form #2

alucard001 opened this issue Nov 17, 2017 · 10 comments

Comments

@alucard001
Copy link

Hi

Here are my config

  • Caldera form v1.5.6.2
  • Caldera Forms Anti Spam 0.1.0

I am following the advice from Caldera Form and use the github plugin . Install and activate this plugin and add it to my caldera form.

My form is just a full page single form, no sub-form/double-triple form or else, only 1 form.

And my recaptcha is using V2. After setting it and go to preview form and real page with form, the recaptcha did not show up (nothing to display). But when I view source code the element is there, and the jQuery script is working fine.

No javascript error also. I test the latest V3(invisible) also but the same.

Can anyone please help because reCAPTCHA is definitely required. Especially for contact form.

Thank you very much in advance for your help.

Attached please find the screenshot for verifying.

001

002

@andrewlimaza
Copy link
Owner

andrewlimaza commented Nov 28, 2017

Hey @alucard001,

Really sorry to hear about this issue, would you mind opening up a support thread on https://yoohooplugins.com/support/ and please feel free to include your Caldera Forms export (JSON) and I will look into this for you personally!

We are working on some issues with this plugin. Thank you so much for your patience, I truly appreciate it.

@andrewlimaza
Copy link
Owner

Do you have more than one form on the same page? Or displaying a Captcha elsewhere on the page? I know there is an issue displaying Captcha's more than once on the same page.

@andrewlimaza
Copy link
Owner

Also our latest version (on here) might fix this issue for you as we've made some adjustments to the ReCaptcha code. This code will be released during the course of this week.

@globalser
Copy link

Hi Andrew,

I have the same exact described issue.

Wordpress:: 4.8.3
Caldera Anti-spam: 0.1.1

The html is the same as Alucard posted. But i have Console error:

recaptcha__en.js:387 Uncaught Error: reCAPTCHA placeholder element must be an element or id
at Object.yr [as render] (recaptcha__en.js:387)
at init_recaptcha_fld_8061997_1 ((index):635)
at HTMLDocument. ((index):642)
at HTMLDocument.dispatch (jquery.js?ver=1.12.4:3)
at HTMLDocument.r.handle (jquery.js?ver=1.12.4:3)
at Object.trigger (jquery.js?ver=1.12.4:3)
at Object.a.event.trigger (jquery-migrate.min.js?ver=1.4.1:2)
at HTMLDocument. (jquery.js?ver=1.12.4:3)
at Function.each (jquery.js?ver=1.12.4:2)
at a.fn.init.each (jquery.js?ver=1.12.4:2)

I've checked online and it appears that it's caused when captcha library os loaded more then once.
Do you know why?

Regards

@globalser
Copy link

globalser commented Apr 12, 2018

The console errors go away if i comment any of the 2 init_recaptcha mentioned above in fields.php:

jQuery(document).on('click', '.reset_<?php echo $field_id; ?>', function(e){
					e.preventDefault();
					init_recaptcha_<?php echo $field_id; ?>();
				});
				init_recaptcha_<?php echo $field_id; ?>();
			});
		});
	</script>

The captcha is still not showing on the form.
The HTML (i removed the sitekey from the html since i don't want it public):

<div class="">
<input required="" type="" data-field="fld_1802870" class=" form-control" id="fld_1802870_3" name="fld_1802870" value="" data-type="recaptcha" aria-required="true" aria-labelledby="fld_1802870Label">
<div id="capfld_1802870_3" class="g-recaptcha" data-sitekey=""></div>
</div>

There is only one form on the page, it's a simple contact form.
If need to see this live, please provide your e-mail i will gladly send the url for you to see it yourself.

Regards

@shaneonabike
Copy link

We are experiencing the same issue. Oddly enough we don't have two recaptcha's but it appears that the plugin is generating two functions.

`

jQuery( function($){
  |  
  | jQuery(document).on("cf-anti-init-recaptcha", function(){
  | function init_recaptcha_fld_4885058_1(){
  | var captch = $('#capfld_4885058_1');
  |  
  | captch.empty();
  | grecaptcha.render( captch[0], { "sitekey" : "6Le05ocUAAAAAMbOuzVGIrzbr3mRGR5xHou1BzjX", "theme" : "light" } );
  | }
  | jQuery(document).on('click', '.reset_fld_4885058_1', function(e){
  | e.preventDefault();
  | init_recaptcha_fld_4885058_1();
  | });
  |  
  | init_recaptcha_fld_4885058_1();
  | });
  | });</script> <script>window.addEventListener("load", function(){
  |  
  | jQuery(document).on('click dblclick', '#fld_7908577_1', function( e ){
  | jQuery('#fld_7908577_1_btn').val( e.type ).trigger('change');
  | });
  |  
  | });</script> <script>var cf_recaptcha_is_ready = function (){
  | jQuery(document).trigger("cf-anti-init-recaptcha");
  | }
  |  
  | jQuery( function($){
  |  
  | jQuery(document).on("cf-anti-init-recaptcha", function(){
  | function init_recaptcha_fld_4885058_2(){
  | var captch = $('#capfld_4885058_2');
  |  
  | captch.empty();
  | grecaptcha.render( captch[0], { "sitekey" : "6Le05ocUAAAAAMbOuzVGIrzbr3mRGR5xHou1BzjX", "theme" : "light" } );
  | }
  | jQuery(document).on('click', '.reset_fld_4885058_2', function(e){
  | e.preventDefault();
  | init_recaptcha_fld_4885058_2();
  | });
  |  
  | init_recaptcha_fld_4885058_2();
  | });
  | });</script> <script>window.addEventListener("load", function(){
  |  
  | jQuery(document).on('click dblclick', '#fld_7908577_2', function( e ){
  | jQuery('#fld_7908577_2_btn').val( e.type ).trigger('change');
  | });
 

`

In our case the fld_7908577_2 is valid.

@shaneonabike
Copy link

Just to add what's interesting is that this works really well on other pages. The only thing that I can point out differently for this page is that it has other embed code like a Google map.

@shaneonabike
Copy link

So further debugging is showing that the plugin is actually embedding the code (id reference) for the other form, which is ubber odd because it doesn't appear on the page

andrewlimaza pushed a commit that referenced this issue Jun 1, 2020
Core changes:
* Removed older Caldera code they no longer have in mainline
* Made it clearer when using v2 or v3
* Passing WordPress CodeSniffer rules
* Script now injects at footer of page
* Execution only happens at form submission
* v3 implementation is less likely to make Google think we want a v2
andrewlimaza added a commit that referenced this issue Jun 1, 2020
Overhaul to execute at form submission (#2)
@benancy
Copy link

benancy commented Dec 23, 2020

reCaptcha didnt show:
https://www.verlichte-dansvloer.nl/contact/

I follow all steps. I didnt understand. How can i resolve this problem?

@megaozono
Copy link

Tengo un problema con el captcha, si aparece en la web pero no en la versión del móvil. Agradeceré puedan ayudarme ya que los usuarios que ingresan desde su teléfono no pueden enviar el formulario.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants