oneline
08-29-2010, 01:51 AM
I guess it is because it is 2am and had a few beers but i cannot get this to work and i know its pretty simple to do - see the code below:
{if ""|fn_needs_image_verification == true}
{assign var="is" value="Image_verification"|fn_get_settings}
<p{if $align} class="{$align}"{/if}>{$lang.image_verification_body}</p>
{assign var="id_uniqid" value=$id|uniqid}
{literal}
<script language="javascript" type="text/javascript">
function reloadCaptcha() {
captcha = document.getElementById("captureURLID").src;
return captcha += 'reload';
}
</script>
{/literal}
{if $sidebox}
<p><img id="verification_image_{$id}" class="image-captcha valign" src="{"image.captcha?verification_id=`$SESS_ID`:`$id`&`$id_uniqid`&"|fn_url:'C':'rel':'&'}" alt="" onclick="this.src += 'reload' ;" width="{$is.width}" height="{$is.height}" /></p>
{/if}
<p><input class="captcha-input-text valign" type="text" name="verification_answer" value= "" autocomplete="off" />
{if !$sidebox}
<img id="verification_image_{$id} captureURLID" class="image-captcha valign" src="{"image.captcha?verification_id=`$SESS_ID`:`$id`&`$id_uniqid`&"|fn_url:'C':'rel':'&'}" alt="" onclick="this.src += 'reload' ;" width="{$is.width}" height="{$is.height}" />
{/if}
<img src="{$images_dir}/icons/icon_reload.png" height="25" width="25" alt="Reload Captcha Image" onclick="reloadCaptcha();" class="valign image-captcha" /></p>
{/if}
now the following works totally fine, when you click the captcha code changes..... "onclick="this.src += 'reload'" you will notice i have added a custom reload button image below this with a onclick calling a custom function "reloadCaptcha(); which i want to reload the captcha image above it - however it is not working, i have done the function so it grabs the src from the element ID, i have added 2 ID's to the IMG but cannot remember if you can have multiple IDs or not which if not could be causing the problem but not 100% sure how to include the smarty code for the generated ID on that image.
Any ideas on the code above from having a quick glimps? as the code stands i get the error:
Error: captureURL is null
Many Thanks
{if ""|fn_needs_image_verification == true}
{assign var="is" value="Image_verification"|fn_get_settings}
<p{if $align} class="{$align}"{/if}>{$lang.image_verification_body}</p>
{assign var="id_uniqid" value=$id|uniqid}
{literal}
<script language="javascript" type="text/javascript">
function reloadCaptcha() {
captcha = document.getElementById("captureURLID").src;
return captcha += 'reload';
}
</script>
{/literal}
{if $sidebox}
<p><img id="verification_image_{$id}" class="image-captcha valign" src="{"image.captcha?verification_id=`$SESS_ID`:`$id`&`$id_uniqid`&"|fn_url:'C':'rel':'&'}" alt="" onclick="this.src += 'reload' ;" width="{$is.width}" height="{$is.height}" /></p>
{/if}
<p><input class="captcha-input-text valign" type="text" name="verification_answer" value= "" autocomplete="off" />
{if !$sidebox}
<img id="verification_image_{$id} captureURLID" class="image-captcha valign" src="{"image.captcha?verification_id=`$SESS_ID`:`$id`&`$id_uniqid`&"|fn_url:'C':'rel':'&'}" alt="" onclick="this.src += 'reload' ;" width="{$is.width}" height="{$is.height}" />
{/if}
<img src="{$images_dir}/icons/icon_reload.png" height="25" width="25" alt="Reload Captcha Image" onclick="reloadCaptcha();" class="valign image-captcha" /></p>
{/if}
now the following works totally fine, when you click the captcha code changes..... "onclick="this.src += 'reload'" you will notice i have added a custom reload button image below this with a onclick calling a custom function "reloadCaptcha(); which i want to reload the captcha image above it - however it is not working, i have done the function so it grabs the src from the element ID, i have added 2 ID's to the IMG but cannot remember if you can have multiple IDs or not which if not could be causing the problem but not 100% sure how to include the smarty code for the generated ID on that image.
Any ideas on the code above from having a quick glimps? as the code stands i get the error:
Error: captureURL is null
Many Thanks