Renaming view variable to image_id to avoid collision with the field id (see #43)

This commit is contained in:
Gregwar 2013-01-04 08:31:59 +01:00
parent 35405aca2e
commit 435cc44f91
2 changed files with 5 additions and 5 deletions

View File

@ -3,15 +3,15 @@
-
{% else %}
{% 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 %}
<script type="text/javascript">
function reload_{{ id }}() {
var img = document.getElementById('{{ id }}');
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_{{ id }}();">{{ 'Renew'|trans({}, 'gregwar_captcha') }}</a>
<a class="captcha_reload" href="javascript:reload_{{ image_id }}();">{{ 'Renew'|trans({}, 'gregwar_captcha') }}</a>
{% endif %}
{{ form_widget(form) }}
{% endspaceless %}

View File

@ -93,7 +93,7 @@ class CaptchaType extends AbstractType
'captcha_width' => $options['width'],
'captcha_height' => $options['height'],
'reload' => $options['reload'],
'id' => uniqid('captcha_'),
'image_id' => uniqid('captcha_'),
'captcha_code' => $this->generator->getCaptchaCode($this->key, $options),
'value' => '',
'is_human' => $isHuman