Forums

Give help. Get help.

  • # September 17, 2017 at 10:31 pm

    Anyone has experience with WP Gravity Forms?

    Google Captcha does not load, I can’t figure out why..

    First I load it on link click- it opens modal and loads Captcha- everything is ok here, but when I click on Form’s Sumbit button- Captcha should reload, but it never happens. here is my code :)

    (function ($) {
    
    'use strict';
    
    $(window).load(function () {
    
        if ($('body').hasClass('page-id-97')){
    
            //THIS WORKS OK
    
            $('.manual-download-link').on('click', function () {
    
                var thisButtonData = $(this).data('popup');
    
                var popUpContainer = $('#popmake-'+thisButtonData);
    
                popUpContainer.find('.g-recaptcha').each(function (index, element) {
    
                    // Ensure field is empty before rendering CAPTCHA
                    if ($(this).is(':empty')) {
                        // Site key
                        var site_key = $(this).attr('data-sitekey');
                        // CAPTCHA theme
                        var theme = $(this).attr('data-theme');
                        // Native DOM element
                        var element = $(this).get(0);
                        // Render CAPTCHA
                        grecaptcha.render(element, {'sitekey': site_key, 'theme': theme});
                    }
                });
    
            });
    
            $('div.gform_footer input').on('click', function () {
    
                $(document).bind('gform_post_render', function () {
    
                    inputForm.each(function (index, element) {
    
                        var n = $(this).find('.g-recaptcha');
    
                        //THIS DOES NOT LOAD CAPCTHA- WHY?! ;(
    
                        // Ensure field is empty before rendering CAPTCHA
                        if (n.is(':empty')) {
                            // Site key♂
                            var site_key = n.attr('data-sitekey');
                            // CAPTCHA theme
                            var theme = n.attr('data-theme');
                            // Native DOM elemento
                            // var element = $(this).get(0);
                            var element = n.get(0);
                            // Render CAPTCHA
                            grecaptcha.render(
                                element, {
                                    'sitekey': site_key,
                                    'theme': theme
                                }
                            );
                        }
                    });
                });
            })
        }
    });
    })(jQuery);
    
    
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag