This repository was archived by the owner on Feb 25, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
src/Resources/views/Form/v3 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 <link rel =" stylesheet" href =" {{ asset(' /bundles/ewzrecaptcha/css/recaptcha.css' ) }}" >
88 {% endif %}
99
10+ {{ form_label(form ) }}
11+ {{ form_widget(form ) }}
12+
1013 <script {% if form .vars .script_nonce_csp is defined and form .vars .script_nonce_csp is not same as (' ' ) %} nonce =" {{ form .vars .script_nonce_csp }}" {% endif %}>
11- grecaptcha .ready (function () {
12- grecaptcha .execute (' {{ form.vars.public_key }}' , { action: ' {{ form.vars.action_name|default(constant(' EWZ \\Bundle\\RecaptchaBundle\\Form\\Type\\EWZRecaptchaV3Type:: DEFAULT_ACTION_NAME ' )) }}' }).then (function (token ) {
13- var recaptchaResponse = document .getElementById (' {{ id }}' );
14- recaptchaResponse .value = token;
14+ var grecaptchaInput = document .getElementById (' {{ id }}' );
15+ grecaptchaInput .value = ' ' ; // Always reset the value to get a brand new challenge
16+ var grecaptchaForm = grecaptchaInput .form ;
17+ grecaptchaForm .addEventListener (' submit' , function (e ) {
18+ e .preventDefault ();
19+
20+ grecaptcha .ready (function () {
21+ grecaptcha .execute (' {{ form.vars.public_key }}' , { action: ' {{ form.vars.action_name|default(constant(' EWZ \\Bundle\\RecaptchaBundle\\Form\\Type\\EWZRecaptchaV3Type:: DEFAULT_ACTION_NAME ' )) }}' }).then (function (token ) {
22+ grecaptchaInput .value = token;
23+ grecaptchaForm .submit ();
24+ });
1525 });
16- });
26+ }, false );
1727 </script >
18-
19- {{ form_label(form ) }}
20- {{ form_widget(form ) }}
2128 {% endif %}
2229{% endapply %}
2330{% endblock %}
You can’t perform that action at this time.
0 commit comments