| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
javascript error on register.tpl | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
![]() 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 |
|||||||||
#2
|
|||||||
|
|||||||
![]() If it suddenly stopped working, it is definitely something that you changed, it may not be in that exact template. Did you make any changes to the individual registration templates (billing, shipping, etc) or add any other JS that might conflict with the reg script?
__________________
Padraic Ryan Ryan Design Studio Professional E-Commerce Development |
|||||||
#3
|
|||||||||
|
|||||||||
![]() Thanks for your reply balinor. Found the problem. It wasn't register.tpl or any other registration template. It was the button.tpl template. I wanted to get rid of the whole ridiculous table in table in table... in button.tpl so I replaced it with a <div> and <a> tags. Originally there was onclick="{$js_link}" statement which I changed to href="{$js_link}" and put it in the <a> tag. Well apparently x-cart didn't like that. When I moved it to the <div> tag as onclick="{$js_link}" it worked. I don't like it much like this but if that's the way to make it work...
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#4
|
|||||||
|
|||||||
![]() Yea, don't you love that default button? What a mess!
__________________
Padraic Ryan Ryan Design Studio Professional E-Commerce Development |
|||||||
#5
|
|||||||||
|
|||||||||
![]() Just a few months ago I was new to x-cart but now I can say it is not just the buttons that are a mess. Well I guess I don't have to tell you this...
![]()
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
|
|||
X-Cart forums © 2001-2020
|