javascript error on register.tpl
I'm doing some changes on my website when suddenly I start getting a javascript error when I try to register, modify account or checkout as an annonymous user. The error is "return statement outside function". I tried with the original register.tpl but the error is still there. The only return statement I see in register.tpl is this function:
<script type="text/javascript" language="JavaScript 1.2">
<!--
var is_run = false;
function check_registerform_fields() {ldelim}
if(is_run)
return false;
is_run = true;
if (check_zip_code(){if $default_fields.email.avail eq 'Y'} && checkEmailAddress(document.registerform.email, '{$default_fields.email.required}'){/if} {if $config.General.check_cc_number eq "Y" AND $config.General.disable_cc ne "Y"}&& checkCCNumber(document.registerform.card_number,do cument.registerform.card_type) {/if}&& checkRequired(requiredFields)) {ldelim}
document.registerform.submit();
return true;
{rdelim}
is_run = false;
return false;
{rdelim}
-->
</script>
wich is then called in the beginning of the form
<form action="{$register_script_name}?{$smarty.server.QU ERY_STRING|amp}" method="post" name="registerform" onsubmit="javascript: check_registerform_fields(); return false;">
and after that with the submit button
{include file="buttons/submit.tpl" button_title=$but_title type="input" style="button" href="javascript: return check_registerform_fields();"}
Now all code above is original x-cart code (except for the button_title). I have no idea why it stoped working. I tried taking out "return" from the button href and then it works as far as showing the "missing something" message but if there is a missing info on the page instead of staying on the same page as it should it redirects to a blank page. Any help is appreciated.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
|