Live Support, Chat, Upload Control and Rich Text Editor
Welcome to Support forums Sign in | Join | Help |Client Center
in Search

IsDirty

Last post 06-09-2010, 10:10 PM by Kenneth. 12 replies.
Sort Posts: Previous Next
  •  05-04-2010, 8:26 AM 60670

    IsDirty

    I am looking for a way to detect on the client-side if the content of editor is "dirty". Meaning: if it has been modified. But i can't seem to find anything in the documentation.
     
    Adam was asked about a "isDirty" JavaScript property In this forum thread from December 2006 and he said "We will include this feature in the coming version 6.0". I can't find any reference to this feature.I could attach to the "onkeypress" event and keep track of a "isDirty" value but that would not take into account the fact that user could click the "undo" button. Also, it doesn't take into account the fact that the user could switch into HTML mode and paste his content.
     
    What is the best way for me to detect if the content of the editor is "dirty"?
  •  05-04-2010, 1:31 PM 60680 in reply to 60670

    Re: IsDirty

    You can use the following method to detect whether the editor content has been changed:
     
    CuteEditor_OnChange

    This event is invoked when the content of Cute Editor is changed.

    Example:

    function CuteEditor_OnChange(editor)

        //when the content be changed..
        document.getElementById("ctl_onchange").innerHTML=editor.id+" changed at "+ new Date().toLocaleTimeString();
    }
     
     
    Regards,
    Eric
  •  05-04-2010, 6:08 PM 60689 in reply to 60680

    Re: IsDirty

    Hi Eric,
    the CuteEditor_OnChange event still have a bug. When the user click on the content of editor without changing anything, it will still trigger this event. quite anoying as a lot of users complianed that they just try to view but it always popup a warning to ask for save.
     
  •  05-04-2010, 10:11 PM 60695 in reply to 60680

    Re: IsDirty

    The problem I see with handling the onchange event, is that it does not account for the user clicking on the "undo" button. Also, is this event raised when the user pastes in the HTML mode?
  •  05-05-2010, 12:37 PM 60747 in reply to 60670

    Re: IsDirty

    frJericho:
    I am looking for a way to detect on the client-side if the content of editor is "dirty". Meaning: if it has been modified. But i can't seem to find anything in the documentation.
     
    Adam was asked about a "isDirty" JavaScript property In this forum thread from December 2006 and he said "We will include this feature in the coming version 6.0". I can't find any reference to this feature.I could attach to the "onkeypress" event and keep track of a "isDirty" value but that would not take into account the fact that user could click the "undo" button. Also, it doesn't take into account the fact that the user could switch into HTML mode and paste his content.
     
    What is the best way for me to detect if the content of the editor is "dirty"?
     
    We are investigating this issue and will provide a better solution soon. Sorry for the inconvenience.
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  05-18-2010, 6:35 PM 61117 in reply to 60747

    Re: IsDirty

    Can you give me a rough estimate when you think you'll be able to provide a solution? I'm not trying to put pressure on you, I just want to know what to tell my users when they ask me why we don't properly detect if their HTML is "dirty".
  •  05-21-2010, 12:27 PM 61237 in reply to 61117

    Re: IsDirty

    We had another incident yesterday where a user forgot to click the "Save" button and he lost his work because our application didn't warn him that his HTML was "dirty".
     
    I would really appreciate if you could tell me when you plan to "provide a better solution" as you mentioned.
  •  05-21-2010, 9:41 PM 61238 in reply to 61237

    Re: IsDirty

    Hi,
     
    We have maked sure the onchange event be fired before editor lost focus or the form be submited.
     
    We will publish the new version on next monday.
     
    Regards,
    Terry
  •  06-02-2010, 9:45 AM 61509 in reply to 61238

    Re: IsDirty

    Has this been released? If so, can you show exactly how we can determine if the content of the editor is "dirty"?
  •  06-09-2010, 9:43 AM 61645 in reply to 61509

    Re: IsDirty

    Any update?
  •  06-09-2010, 9:49 AM 61646 in reply to 61645

    Re: IsDirty

  •  06-09-2010, 3:28 PM 61647 in reply to 61646

    Re: IsDirty

    Can you show me an example how I can determine if the HTML is "dirty"? I want to make sure that I take "undo" and "redo" into consideration and also I want to make sure that user editing the source HTML will also be taken into consideration.
  •  06-09-2010, 10:10 PM 61652 in reply to 61647

    Re: IsDirty

    frJericho:
    Can you show me an example how I can determine if the HTML is "dirty"? I want to make sure that I take "undo" and "redo" into consideration and also I want to make sure that user editing the source HTML will also be taken into consideration.
     
    Hi frJericho,
     
    1. <%@ Page Language="C#" %>      
    2.      
    3. <%@ Register Namespace="CuteEditor" Assembly="CuteEditor" TagPrefix="CE" %>      
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">      
    5.      
    6. <script runat="server">      
    7.     protected override void OnLoad(EventArgs e)      
    8.     {      
    9.         editor1.Text = "change something here..";      
    10.         base.OnLoad(e);      
    11.     }      
    12. </script>      
    13.      
    14. <html xmlns="http://www.w3.org/1999/xhtml">      
    15. <head id="Head1" runat="server">      
    16.     <title>Untitled Page</title>      
    17. </head>      
    18. <body>      
    19.     <form id="form1" runat="server">      
    20.         <div>      
    21.             <CE:Editor ID="editor1" runat="server">      
    22.             </CE:Editor>      
    23.             <input type="button" value="check is dirty" onclick="checkIsDirty()" />      
    24.         </div>      
    25.     </form>      
    26. </body>      
    27. </html>      
    28.      
    29. <script>      
    30. var editor1=document.getElementById("<%= editor1.ClientID %>");      
    31. function checkIsDirty()      
    32. {      
    33.     if(editor1.IsDirty())      
    34.     {      
    35.         alert("is dirty");      
    36.     }      
    37. }      
    38. //now, lost focus can fire the onchange event correctly   
    39. //uncomment the section below to test the on hange event   
    40. //function CuteEditor_OnChange(editor)      
    41. //{       
    42. //  alert('lost focus can fire on change event');   
    43. //}      
    44. </script>    
    Rgards,
     
    ken
View as RSS news feed in XML
Powered by ASP.Net
Copyright 2003 - 2017 CuteSoft Components Inc.. All rights reserved.