Page tree
Skip to end of metadata
Go to start of metadata

This function retrieves the contents of the EditLive! applet, according to the returnBodyOnly setting.

This method is new in EditLive! 8.1.

Syntax

JavaScript
String editliveInstance.getContent([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 contents of the EditLive! editor. This will either be a full HTML document, or the contents within the <body> tag, according to the returnBodyOnly setting.

Synchronous Example (EditLive 8.1+)

Calling getContent synchronously returns the appropriate 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 ID of contents. Images will be uploaded to the server when getContent is called as blnUploadImages is set to true. The name of the EditLive applet is editlive_js.

document.getElementById('contents').value = editlivejs.getContent();

Asynchronous Example (EditLive 8.1+)

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

editlive_js.getContent("retrieveContent", true);

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

function retrieveContent(src){
        document.exampleForm.bodyContent.value = src;
     }

Remarks

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

See Also

 

  • No labels