EditLive! 9 Documentation : getDocument Method

This function retrieves the entire contents of the EditLive! applet.

Prior to version 8.1 this function had no return value and the function was asynchronous. While asynchronous use is still supported, since version 8.1 this function can now be used synchronously with a return value.

Syntax

JavaScript
String editliveInstance.getDocument([jsFunct],[blnUploadImages]);

Parameters

jsFunct

This parameter is optional.

The JavaScript function which receives the retrieved EditLive! applet contents.

blnUploadImages

This parameter is optional.

This is a boolean which indicates whether images should be uploaded to the server when this function is called. The uploading of images will occur immediately before the content is retrieved.

The default value is false.

Returns

The EditLive applet contents.

Example Synchronous (EditLive 8.1+)

Calling getDocument synchronously returns the contents of the editor as a string. This example retrieves the contents of the editor and then saves the retrieved contents to a <textarea> with the name documentContent. Images will be uploaded to the server when getDocument is called as blnUploadImages is set to true. The name of the EditLive applet is editlive_js.

document.exampleForm.documentContent.value = editlive_js.getDocument(true);

Example Asynchronous (EditLive 8.0+)

When calling getDocument asynchronously you must provide a JavaScript function as the callback parameter for the getDocument method. In this example the retrieveDocument callback function receives the contents of the editor as a string. Images will be uploaded to the server when getDocument is called as blnUploadImages is set to true. The name of the EditLive applet is editlive_js.

editlive_js.getDocument('retrieveDocument',true);

The retrieveDocument function receives the contents of the editor and then saves the retrieved contents to a <textarea> with the name documentContents.

function retrieveDocument(src){
		document.exampleForm.documentContent.value = src;
	}

Remarks

When uploading locally stored images to the relevant Web server for an instance of EditLive!, ensure that the blnUploadImages parameter is set to true when calling the getDocument method.