JavaScript used in LotusScript "Syntax Error"

I am using JavaScript in a LotusScript routine to open a new browser window.

Here is the code:

Print |<SCRIPT>|

		Print |window.open("| & homeURL & FormName & |?OpenForm&Route~~| & stepList & |~~| & routeList & |", "Route", "toolbars=no,resizeable=yes,scrollbars=yes,height=500,width=600");|

		Print |</SCRIPT>|

The variable “stepList” can be one or multiples values, as well as routeList.

The Syntax error is occuring in the string:

| & stepList & || & routeList & |"

The new browser window will open when I remove that string above.

Any ideas?

Thanks!

Dan

Subject: RE: JavaScript used in LotusScript “Syntax Error”…

Do you get the syntax error when saving your LotusScript code, or when opening the browser window?

You say that stepList may contain multiple values. I don’t know what that means. Is it an array?

I suspect one of these strings (if they are strings) contains a doublequote character, which you would need to escape so that the JavaScript interpreter doesn’t see it as the end of the string.

Subject: RE: JavaScript used in LotusScript “Syntax Error”…

I’m sorry - I should have explained more…

I receive the “Syntax Error” from the browser window.

“stepList” is a variant-type, you’re right an array.

“routeList” is also an array.

Neither of the arrays have a double-quote character.

Thanks for your help!

Dan

Subject: RE: JavaScript used in LotusScript “Syntax Error”…

You need to give the exact text of an error message and all the details about when it comes up and in what kind of window.

If you receive a JavaScript syntax error, you can probably figure out what the problem is by using View Source to see the JavaScript source code that your LotusScript agent generated.

If a LotusScript variable contains an array, you cannot use & to concatenate it to a string. You must first convert the array value to a string, e.g. by using the Join function. Read about it. However, I would not expect you to get a syntax error from that at runtime, so you might be mistaken about their being arrays.