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.

Terminating the Save Method<br />

Saving Content Manually<br />

Integrating <strong>eWebEditPro</strong> Using JavaScript<br />

Returning false in the onbeforesave event handler terminates the save method<br />

and the onsave event.<br />

For example<br />

<strong>eWebEditPro</strong>.onbeforesave="return confirm(‘Do you want to save?’)";<br />

<strong>eWebEditPro</strong>.onsave="alert(‘Done saving’)";<br />

To manually save content, use this code.<br />

function mysubmit(){<br />

<strong>eWebEditPro</strong>.actionOnUnload = EWEP_ONUNLOAD_NOSAVE;<br />

<strong>eWebEditPro</strong>.save();<br />

document.myform.submit();<br />

Closing a Window without Saving Content<br />

To close a window (that is, cancel) without saving the content to the hidden field,<br />

use this code.<br />

<strong>eWebEditPro</strong>.actionOnUnload = EWEP_ONUNLOAD_NOSAVE;<br />

self.close();<br />

See Also: ”Preventing the Save Caused by an onbeforeunload Event” on<br />

page 573<br />

Prevent Detecting the onsubmit Event<br />

To prevent automatic saving of the content to the hidden field when a submit<br />

button is pressed, use this code. It must appear prior to creating the editor on the<br />

page.<br />

document.myform.<strong>eWebEditPro</strong>SubmitHandled=true;<br />

<strong>eWebEditPro</strong>.create(...);<br />

See Also: ”Preventing the Save Caused by an onbeforeunload Event” on<br />

page 573<br />

Prevent Detecting the onbeforeunload/onunload Event<br />

To prevent automatically saving the content to the hidden field when the Web<br />

page is unloaded, use this code. It must appear prior to creating the editor on the<br />

page.<br />

window.<strong>eWebEditPro</strong>UnloadHandled=true;<br />

<strong>eWebEditPro</strong>.create(...);<br />

See Also: ”Preventing the Save Caused by an onbeforeunload Event” on<br />

page 573<br />

Preventing the Save Caused by an onbeforeunload Event<br />

Sometimes, a user performs an action that causes the current window to close.<br />

For example, he clicks the small X in the top right corner.<br />

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

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

Saved successfully!

Ooh no, something went wrong!