I finally realized that unlike other programming environments, in Designer, when a script fails, it fails silently. It doesnt tell you where the fail point was (which line) or what type of error caused the problem (object type mismatch, undeclaired variable, etc.)
I eventually started shotgunning app.alert("error1") lines between every line of code, just to figure out which line in a particular secion was failing. There has got to be a better way than that!
So the question: Is there a way to enable/show runtime scripting errors, with information about the type of error, and on which line it occured?
Solved! Go to Solution.
Views
Replies
Total Likes
The console will give you the line number of the error. See in the screen shot, the error is given then the line number, then the object that is calling the script that is causing the error.
And here is the associated script that is causing the error.
Paul
Views
Replies
Total Likes
Hi,
You can access the javascript console in Acrobat by pressing Control+J.
If you are having problems in your script you can insert the following:
console.println("a tag for what you are looking for: " + vVariable);
Then when previewing your form, the line is printed in the javascript console, together with the value (etc.)
Works very well for debugging and you don't have to keep clearing app.alerts.
Good luck,
Niall
I've gotten to the javascript console, but had no success getting it to show me anything useful.
Are there particular things you can do with that console that will show you errors or line numbers?
Views
Replies
Total Likes
Hi,
If a script falls over it will tell you the object containing the script; the particular event; and in most cases why, for example something has no properties.
I don't think you can get it to give line numbers, but it wouldn't be the first time I was wrong. Unless you have a very long / complex script, I find that the indication of the problematic object / event is enough to target the issue.
Niall
The console will give you the line number of the error. See in the screen shot, the error is given then the line number, then the object that is calling the script that is causing the error.
And here is the associated script that is causing the error.
Paul
Views
Replies
Total Likes
Thanks guys, that was exactly the information i was looking for.
Also, it seems like you do have to have the console window open already before you run the script, so that was tripping me up for a while.
Views
Replies
Total Likes
You can also use the button in LC's script editor that looks like a book with a checkmark - it will do basic syntax checking.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies