Renaming view variable to image_id to avoid collision with the field id (see #43)
This commit is contained in:
parent
35405aca2e
commit
435cc44f91
|
@ -3,15 +3,15 @@
|
||||||
-
|
-
|
||||||
{% else %}
|
{% else %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
<img id="{{ id }}" src="{{ captcha_code }}" alt="" title="captcha" width="{{ captcha_width }}" height="{{ captcha_height }}" />
|
<img id="{{ image_id }}" src="{{ captcha_code }}" alt="" title="captcha" width="{{ captcha_width }}" height="{{ captcha_height }}" />
|
||||||
{% if reload %}
|
{% if reload %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function reload_{{ id }}() {
|
function reload_{{ image_id }}() {
|
||||||
var img = document.getElementById('{{ id }}');
|
var img = document.getElementById('{{ image_id }}');
|
||||||
img.src = '{{ captcha_code }}?n=' + (new Date()).getTime();
|
img.src = '{{ captcha_code }}?n=' + (new Date()).getTime();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<a class="captcha_reload" href="javascript:reload_{{ id }}();">{{ 'Renew'|trans({}, 'gregwar_captcha') }}</a>
|
<a class="captcha_reload" href="javascript:reload_{{ image_id }}();">{{ 'Renew'|trans({}, 'gregwar_captcha') }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ form_widget(form) }}
|
{{ form_widget(form) }}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
|
|
|
@ -93,7 +93,7 @@ class CaptchaType extends AbstractType
|
||||||
'captcha_width' => $options['width'],
|
'captcha_width' => $options['width'],
|
||||||
'captcha_height' => $options['height'],
|
'captcha_height' => $options['height'],
|
||||||
'reload' => $options['reload'],
|
'reload' => $options['reload'],
|
||||||
'id' => uniqid('captcha_'),
|
'image_id' => uniqid('captcha_'),
|
||||||
'captcha_code' => $this->generator->getCaptchaCode($this->key, $options),
|
'captcha_code' => $this->generator->getCaptchaCode($this->key, $options),
|
||||||
'value' => '',
|
'value' => '',
|
||||||
'is_human' => $isHuman
|
'is_human' => $isHuman
|
||||||
|
|
Loading…
Reference in New Issue