FormCalc Syntax Error Tips

| 1 Comment

FormCalc has a few possible syntax errors, and they aren't always easy to decipher. Here's a tip for when you get the "Syntax error near token '%1' on line %2, column %3.":

Generally, %1 will contain the token (word) nearest to the error. Please note that the token is not necessarily incorrect, and does not necessarily have anything to do with the error, other than proximity to the problem.

var b = abc(1)
if (b ne 1) then
//comment

The script above will generate a 7008 error: “Syntax error near token ‘then’ on line on line x, column y.” The actual error in this case is that the ‘endif’ token is missing from the script. The last correct token is ‘then’ (comments do not count as tokens.)

The way to fix this problem would be to add an ‘endif’ statement to the end of the script.

Learning Resources is putting together more extensive documentation for the syntax error messages which will hopefully be available on the Web shortly after we ship 8.2.

1 Comment

Showing an error message when there is a syntax error is admissible.

But, unlike with JavaScript code, in run-time errors, FormCalc code always shows an error message to the user, including the «whole code that failed» (even if that occupies the whole screen) and, finally, the description of the error!!

This, imho, is an absurd, and can only be understood as some market-like feature.

If it is a matter of "protecting" the final user...then perhaps JavaScript and its try/catch/finally constructs should be discontinued.

Is there *any* way to prevent FormCalc error messages from displaying?

Leave a comment

About this Entry

This page contains a single entry by Stephanie Legault published on May 29, 2008 3:18 PM.

A Shortcut for Inserting SOM Expressions into your Script was the previous entry in this blog.

Spell Check Locale Mapping is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Categories

Pages

Powered by Movable Type 4.261