View Full Version : Syntax error!


03-04-2007, 01:29 PM
I'm getting the following error each time I highlight or open the "checkoutcomp.a5w" page in the AlphaSportsWeb application (the error does not prevent me from opening and editing the page):

"A runtime error has occurred.
Do you wish to Debug?

Line 357.
Error: Syntax error."

The line in question is part of the javascript that validates the CC information:

350 <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
351 <!--CSS for tmpl_grd_prodnav -->
352 <link rel="stylesheet" type="text/css" href="file:///C:\Program Files\A5V8/css/shopcart/style.css">
353 <!--Alpha Five Temporary Code End -->
354 <script language="javascript" src="javascript/a5_html_csv.js"></script>
355 <script type="text/javascript" language="javascript">
356 <!--
357 var form1_validation = new Object
358 <%a5 if session.__protected__chkout.customerid = "" ' no customer id passed
359 ?validate_newcust_html
360 end if %>
form1_validation.cc_name = new Object()
form1_validation.cc_name.type = 'c';

If I move the A5 code, lines 358,359, and 360, the error goes away, but the page doesn't work.

This error ONLY happens when I am working in the "Web projects control panel". If I leave the code as is and publish the project locally for testing, the page seems to work perfectly.

I guess my question is:

Is this something that can be fixed? Or is it just a glitch that happens during design? I'm new at this and javascript is still on my list of things that I NEED to learn.

Jim Smith

Steve Workings
03-04-2007, 03:47 PM
Just some minor changes should put you in business. I'd do it like this:

if eval_valid("session.__protected__chkout.customerid")
' no customer id passed
if session.__protected__chkout.customerid = ""
end if
end if

03-04-2007, 06:00 PM
Thanks Steve,

I tried your code and still have the same error. The javascript seems to object to the A5 code syntax. Is A5 code supposed to work within a javascript script??


Steve Workings
03-04-2007, 06:20 PM
Oh, I hadn't noticed that. I know Xbasic, but not javascript so it didn't pop out to me. Yeah, I would expect that's your problem. More precisely, I think, the javascript doesn't know what to do with non-javascript code.