Testing and debugging calculations and scripts

After you create your calculations or scripts and tested your form design, you may discover scripting errors or unexpected field values as a result of scripting syntax errors.

Designer includes three primary methods for testing and debugging your calculations and scripts:

  • Using the Designer workspace palettes. For more information, seeUsing the workspace to debug calculations and scripts .

  • For JavaScript only, using the JavaScript Debugger to assist you in testing your scripts. For more information about using the debugger, see JavaScript Debugging.

  • Using the host model and event model properties and methods to troubleshoot your form.

The host model and event model provide functionality that lets you interact with either the host application or the various form events. These models are useful for returning information that can assist you in debugging calculation and scripts.

For example, the following script returns a message at run time indicating the name of the event on which the script is placed. This indicates that a particular event has fired:

    xfa.host.messageBox(xfa.event.name) // FormCalc xfa.host.messageBox(xfa.event.name); // JavaScript

Another example of using the host model and event model methods is to obtain the value of a field on an interactive form before a user manually changed it. This is useful for observing how the objects on your form design respond to user-entered data:

    xfa.host.messageBox(xfa.event.prevText) // FormCalc xfa.host.messageBox(xfa.event.prevText); // JavaScript

// Ethnio survey code removed