JavaScript

{dialog.object}debugInfoToFile Method

Syntax

{dialog.object}.debugInfoToFile(data, filename [, append [, silent]]);

Arguments

dataAny Type

The data you want to write to the file. If the data is an Object, you must serialize it using JSON.stringify()

filenamestring

The fully qualified filename on the server where the data should be written

appendboolean

Defaults to false. If true, the data are appended to the end of an existing file

silentboolean

Defaults to false. If true, the confirmation message is suppressed.

Description

Writes client-side data to a file on the server.

Discussion

This method is useful when debugging an application and you want to examine some client-side data. While you can typically use Alerts in client side code to examine data, or in some case use console.log() commands (not always possible when the app is running on a mobile device), this method allows you to write client side data to a file on the server.

In cases where you do not have permission to write to server files (e.g. when running under IIS or on the Alpha Cloud), the companion {dialog.object}.debugInfoToS3() method can be used to write to a file on an S3 bucket.

Example

var list = {dialog.object}.getControl('list1');
var data = JSON.stringify(list._data,'','\t');
var filename = 'c:\\debuginfo\\file1.txt';
{dialog.object}.debugInfoToFile(data,filename,true,false);

See Also