15.08.2013 Views

Ektron® eWebEditPro Developer's Reference Guide

Ektron® eWebEditPro Developer's Reference Guide

Ektron® eWebEditPro Developer's Reference Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The onerror Event<br />

JavaScript Objects<br />

This instance object has properties, methods, and events. You can also access<br />

the instancetypes array.<br />

For documentation of the methods, properties, and events, see ”Instances Object”<br />

on page 9.<br />

Note that, for the instance object’s onerror event,<br />

• usually only the source property is available<br />

• the event only fires if the save method fails<br />

If the status of the <strong>eWebEditPro</strong> object is EWEP_STATUS_SIZEEXCEEDED,<br />

two additional event properties are available to help troubleshoot the error.<br />

• contentSize - the number of characters in the content<br />

• maxContentSize - the maximum number of characters permitted, as<br />

specified by the maxContentSize parameter (See “Property:<br />

maxContentSize” on page 130.)<br />

Here is an example of how to use these properties.<br />

function myOnErrorHandler()<br />

{<br />

if (EWEP_STATUS_SIZEEXCEEDED == this.status && "save" == this.event.source)<br />

{<br />

var strMsg = "HTML content size (in chars): " + this.event.contentSize + "<br />

Maximum: " + this.event.maxContentSize;<br />

alert(strMsg);<br />

}<br />

}<br />

<strong>eWebEditPro</strong>.instances.MyContent1.onerror = myOnErrorHandler; //<br />

The instanceTypes Array<br />

Note that you cannot use ...onerror = "myOnErrorHandler()"; .<br />

You can list all possible editor types by accessing the <strong>eWebEditPro</strong> JavaScript<br />

Object's instanceTypes array. For example:<br />

document.write("Instance Types:");<br />

for (var i = 0; i < <strong>eWebEditPro</strong>.instanceTypes.length; i++)<br />

{<br />

document.write("&nbsp;&nbsp;" + <strong>eWebEditPro</strong>.instanceTypes[i].type + "");<br />

}<br />

Also, you can use the instanceTypes Array to determine which type of editor to<br />

create. For example, to prevent the ActiveX-based editor from being created,<br />

assign a false value to this syntax:<br />

instanceTypes["activex"].isSupported<br />

If set to true, ActiveX is supported.<br />

<strong>Ektron®</strong> <strong>eWebEditPro</strong> Developer’s <strong>Reference</strong> <strong>Guide</strong>, Release 5.1, Revision 1 241

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!