我正在使用EWZRecaptchaBundle,這是一個爲Symfony提供reCAPTCHA表單字段的包。如何使用EWZRecaptchaBundle在單個頁面上顯示多個recaptchas?
當我嘗試渲染1 recaptcha它工作正常,但是當我嘗試2時,它只顯示第一個。
是否可以使用此捆綁包在單個頁面上顯示多個recaptchas?
我的代碼:
composer.json
"require": {
...
"excelwebzone/recaptcha-bundle": "~1.4.1",
}
AppKernel.php
$bundles = array(
// ...
new EWZ\Bundle\RecaptchaBundle\EWZRecaptchaBundle(),
// ...
);
# app/config/config.yml
ewz_recaptcha:
public_key: here_is_your_public_key
private_key: here_is_your_private_key
locale_key: %kernel.default_locale%
//form class
<?php
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('recaptcha', 'ewz_recaptcha', [
'required' => true,
'constraints' => [
new RecaptchaTrue()
],
'mapped' => false,
])
//twig template
<div id="recaptcha_google_div" {% if not signupForm.recaptcha.vars.valid %}class="left"{% endif %}>
{{ form_widget(signupForm.recaptcha) }}
{{ form_errors(signupForm.recaptcha) }}
</div>
你可以張貼一些代碼,就像樹枝模板 – nowiko
問題尋求幫助調試(「爲什麼不是這個代碼的工作?」)必須包括所期望的行爲,一個特定的問題或錯誤,並在最短的代碼要重現它在質疑自己。沒有一個明確的問題說明問題並不 –