We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'd like renew_captcha button to chanege code&image to new one. But it just renews the same image as we can see on generated Javascript code:
<script type="text/javascript"> function reload_captcha_5a6b33132e1ff() { var img = document.getElementById('captcha_5a6b33132e1ff'); img.src = '/captcha/c587a12bc2c53733177b8cbc2f684752.jpg?n=' + (new Date()).getTime(); } </script>
Is there a feature that one can change displayed captcha image&code without reloading the page?
I am using Symfrony 3.4
PHP code: $builder->add ( 'captcha', CaptchaType::class, [ 'attr' => [ 'class' => 'form-control' ], 'reload' => true, 'as_url' => true, 'as_file' => true ] );
$builder->add ( 'captcha', CaptchaType::class, [ 'attr' => [ 'class' => 'form-control' ], 'reload' => true, 'as_url' => true, 'as_file' => true ] );
TWIG: source <img class="captcha_image" id="{{ image_id }}" src="{{ captcha_code }}" alt="" title="captcha" width="{{ captcha_width }}" height="{{ captcha_height }}" /> {% if reload %} <script type="text/javascript"> function reload_{{ image_id }}() { var img = document.getElementById('{{ image_id }}'); img.src = '{{ captcha_code }}?n=' + (new Date()).getTime(); } </script> <a class="captcha_reload" href="javascript:reload_{{ image_id }}();">{{ 'Renew'|trans({}, 'gregwar_captcha') }}</a> {% endif %}
<img class="captcha_image" id="{{ image_id }}" src="{{ captcha_code }}" alt="" title="captcha" width="{{ captcha_width }}" height="{{ captcha_height }}" /> {% if reload %} <script type="text/javascript"> function reload_{{ image_id }}() { var img = document.getElementById('{{ image_id }}'); img.src = '{{ captcha_code }}?n=' + (new Date()).getTime(); } </script> <a class="captcha_reload" href="javascript:reload_{{ image_id }}();">{{ 'Renew'|trans({}, 'gregwar_captcha') }}</a> {% endif %}
Browser doesn't show any erros. Network shows request that the same image is being donloaded again.
The text was updated successfully, but these errors were encountered:
hello, I know the tipic is old, but maybe it will help some.
After putting: as_url: true reload: true the form rendering and its script for the renew button routing in routing.yml
Do not forget to authorize the route in your acess_control (security.yml) for the url to call images
that's what was blocking me.
Sorry, something went wrong.
No branches or pull requests
I'd like renew_captcha button to chanege code&image to new one. But it just renews the same image as we can see on generated Javascript code:
<script type="text/javascript"> function reload_captcha_5a6b33132e1ff() { var img = document.getElementById('captcha_5a6b33132e1ff'); img.src = '/captcha/c587a12bc2c53733177b8cbc2f684752.jpg?n=' + (new Date()).getTime(); } </script>
Is there a feature that one can change displayed captcha image&code without reloading the page?
I am using Symfrony 3.4
PHP code:
$builder->add ( 'captcha', CaptchaType::class, [ 'attr' => [ 'class' => 'form-control' ], 'reload' => true, 'as_url' => true, 'as_file' => true ] );
TWIG: source
<img class="captcha_image" id="{{ image_id }}" src="{{ captcha_code }}" alt="" title="captcha" width="{{ captcha_width }}" height="{{ captcha_height }}" /> {% if reload %} <script type="text/javascript"> function reload_{{ image_id }}() { var img = document.getElementById('{{ image_id }}'); img.src = '{{ captcha_code }}?n=' + (new Date()).getTime(); } </script> <a class="captcha_reload" href="javascript:reload_{{ image_id }}();">{{ 'Renew'|trans({}, 'gregwar_captcha') }}</a> {% endif %}
Browser doesn't show any erros. Network shows request that the same image is being donloaded again.
The text was updated successfully, but these errors were encountered: