Hi,
i'm trying to configure "confirm save before exit", the problems i'm facing is when i try to configure IsDirty with onbeforeunload javascript ,
1) the message pops up while i hit the fck editor's SAVE button, which should not happen.
2) if the editor is blank and if try to navigate to other page, the IsDirty() is returning true instead of false.
i'm trying to configure "confirm save before exit", the problems i'm facing is when i try to configure IsDirty with onbeforeunload javascript ,
1) the message pops up while i hit the fck editor's SAVE button, which should not happen.
2) if the editor is blank and if try to navigate to other page, the IsDirty() is returning true instead of false.
window.onbeforeunload = confirmExit;
function confirmExit(){
if(FCKeditorAPI.GetInstance('EditorDefault').IsDirty()){
return "The notes is not saved yet, Please press cancel to go back and save";
}
}
Re: problems while configuring IsDirty()
// called when FCKeditor is done starting.. function FCKeditor_OnComplete( editorInstance ){ editorInstance.LinkedField.form.onsubmit = doSave; editorInstance.Events.AttachEvent( 'OnAfterLinkedFieldUpdate', confirmExitUtil ) ; } //Confirm Save before leaving the page window.onbeforeunload = confirmExit; var flag = new Boolean(true); function confirmExitUtil( editorInstance ){ flag = false; } function confirmExit(){ var oEditor = FCKeditorAPI.GetInstance('EditorDefault') ; if(oEditor.IsDirty()){ if(flag){ return "The notes is not saved yet, Please press cancel to go back and save"; } }//end if isdirty }//end function confirmExit()