1

jquery モバイル アプリケーションで reCaptcha を zend フォームに実装しようとすると問題が発生します。jquery mobile が無効になっている場合、すべて問題ありませんが、使用する必要がありますが、recaptcha + 検証メッセージからのラベルしか表示されません。

$recaptcha = new Zend_Service_ReCaptcha(
    '644443tQSAA4444444444444444444WNm6',
    '6L44443444444444444444444EmA_4448');

$captcha = new Zend_Form_Element_Captcha('challenge2',
    array(
        'captcha'        => 'ReCaptcha',
        'captchaOptions' => array(
            'captcha' => 'ReCaptcha', 
            'service' => $recaptcha
        )
    )
);

$captcha->setLabel('hello');        
$captcha->setErrorMessages(array( 'Please retape above words correctly'));
$this->addElement($captcha);

しようとしまし$captcha->setAttrib('data-role', 'none')たが、役に立ちませんでした。
Zend Frameworkを使用してjQuery MobileでreCaptchaを表示するには?

4

1 に答える 1

0

ここには、これを処理する方法に関する情報があります https://developers.google.com/recaptcha/docs/display?hl=en#AJAX

私がしたことは、このスクリプトをレイアウトに追加することです:

<script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>

次に、キャプチャのあるページに、次のコードがあります。

$('[data-role=page]').on('pagebeforeshow', function (event, ui) {
    if ($('#recaptcha_widget_div').length<1) { //if it was not loaded earlier
        Recaptcha.create("<your key>", 'captcha-element', {
            lang : 'en',
            tabindex: 1,
            theme: "clean",
            callback: Recaptcha.focus_response_field
        });
    }
}

「captcha-element」は、私の captcha 要素をラップする div の ID です。

于 2013-05-13T10:49:15.177 に答える