未捕获的错误:此元素中已经呈现了reCAPTCHA

时间:2018-10-11 07:47:15

标签: javascript recaptcha

我正在尝试在单个vf页面中放置多个验证码。这是用visualforce组件编写的。加载时,我只能看到一个验证码。当我完成检查元素时,出现此错误:

error Message pic

VF组件:

<apex:component >
<apex:attribute type="CmpResult" name="recaptaReslt" required="true" description="Show or Hide the button" assignTo="{!reslt}"/>
<head>
    <apex:slds />
    <script type="text/javascript">
    var onloadCallback = function() {
        grecaptcha.render('theCAPTCHA', {
            'sitekey' : '6Lecb0AUAAAAADqGh7PRcKG1tmB2EChkJhObgdpF',
            'callback' : verifyCallback,
            'expired-callback' : expiredCall,
            'theme' : 'light'
        });
    };

    var verifyCallback = function(response) {
        if (response == ""){

        }
        else{
            validate(response);
        }
    }

    var expiredCall = function() {
        expireVerification();
    }
    </script>
</head>
<body>
    <div class="slds-scope">
        <apex:form>
            <div id="theCAPTCHA" class="g-recaptcha" style="transform: scale(0.74);transform-origin: 0 0;-webkit-transform:scale(0.74);-webkit-transform-origin: 0 0"></div>
            <script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit"></script>
            <apex:actionFunction name="validate" action="{!verifyResponse}" reRender="enableButton">     
                <apex:param name="firstParam" assignTo="{!tok}" value="" />
                    </apex:actionFunction>
                <apex:actionFunction name="expireVerification" action="{!expireToken}" reRender="disableButton"/>   

                    </apex:form>
                </div>
                </body>
                </apex:component>

0 个答案:

没有答案