Testing Form Scripts
There are three types of errors you need to remove from your scripts.
-
Syntax errors — These errors can be caught before your script is executed. Syntax errors are displayed in the Editor.
For example:
OpenAir checks scripts for correct syntax before allowing them to be deployed. An error is displayed if you attempt to deploy a script with syntax errors.
Note:This error is caused because Var had been typed in place of var, JavaScript is case sensitive. See Variables for more details.
-
Runtime errors — These errors occur during run time. OpenAir report runtime errors in the log.
Click on the View Log link to see the log messages. See also Reporting.
This error was caused because the script attempted to call a method that doesn’t exist, that is, NSOA.form.getLabel2 does not exist.
function test() { var value = NSOA.form.getValue('budget_time'); var label = NSOA.form.getLabel2('budget_time'); }
In JavaScript missing methods can only be detected at runtime.
Tip:If you load the script into the Editor you can quickly find the line number reported in the log.
-
Logic errors — These errors are the most difficult type to track down. They are not the result of a syntax or runtime error. Instead, they occur when you make a mistake in the logic that drives your script and you do not get the result you expected.
Tip:You can use the NSOA.meta.alert(message) function to log debugging information.
Test scripts thoroughly in a Sandbox account before deploying to a Production account.
See also Testing and Debugging.