problem in IsDirty

Last post 12-13-2010, 11:48 PM by cutechat. 8 replies.
Sort Posts: Previous Next
  •  12-05-2010, 4:57 PM 65277

    problem in IsDirty

    Hi,
    I found following code in the forum. However it has a problem. If I just click in the editor without changing anything there, the isDirty is still "true". That's not right as the user doesn't change anything.
    I use firefox.
    Can anyone pls have a look at the issue.





    var editor1=document.getElementById(
    "<%= editor1.ClientID %>");      

    function checkIsDirty()      

    {      

        if(editor1.IsDirty())      

        {      

            alert("is dirty");      

        }      

    }  

  •  12-05-2010, 6:07 PM 65281 in reply to 65277

    Re: problem in IsDirty

    Dear wolf11th,
     
    I have tested the following code in firefox, it works fine, please refer to it.
     
    <%@ Page Language="C#" %>    
    <%@ Register Namespace="CuteEditor" Assembly="CuteEditor" TagPrefix="CE" %>  
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
     
    <script runat="server">  
        protected override void OnLoad(EventArgs e)  
        {  
            editor1.Text = "change something here..";  
            base.OnLoad(e);  
        }  
    </script>  
     
    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head id="Head1" runat="server">  
        <title>Untitled Page</title>  
    </head>  
    <body>  
        <form id="form1" runat="server">  
            <div>  
                <CE:Editor ID="editor1" runat="server">  
                </CE:Editor>  
                <input type="button" value="check is dirty" onclick="checkIsDirty()" />  
            </div>  
        </form>  
    </body>  
    </html>  
     
    <script>  
    var editor1=document.getElementById("<%= editor1.ClientID %>");  
    function checkIsDirty()  
    {  
        if(editor1.IsDirty())  
        {  
            //set_updated()  
            alert("is dirty");  
        }  
    }  
    function CuteEditor_OnChange(editor)  
    {   
      checkIsDirty();  
    }  
    </script>    
    Thank you for asking
     
     
  •  12-05-2010, 8:33 PM 65288 in reply to 65281

    Re: problem in IsDirty

    Hi Eric,
    not too sure what "base.OnLoad(e);" is
    I use VB.net and I tried to use MyBase.OnLoad(e). It reports an error. i can still compile the code without this line. However, it popup the alert when you just click in the editor. (I didn't change anything there)

  •  12-06-2010, 11:48 AM 65297 in reply to 65288

    Re: problem in IsDirty

    Dear wolf11th,
     
    The following example is vb code, please refer to it:

    <%@ Page Language="vb"%>
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <html>
        <head>
      <title>ASP and ASP.NET WYSIWYG Editor - Default Configuration </title>
      <link rel="stylesheet" href="../example.css" type="text/css" />
     </head>
     <body>
            <form id="Form1" runat="server">   
         
          <CE:Editor id="Editor1" runat="server" ></CE:Editor><br />
           <input type="button" value="check is dirty" onclick="checkIsDirty()" /> 
                               </form>
     </body>
    </html>

    <script runat="server">
     Public Sub Page_Load(sender As object, e As System.EventArgs)       
             If Not Page.IsPostBack Then
       Editor1.Text = "Type Here"
       End If
     End Sub

    </script>

    <script type="text/javascript">
        var editor1 = document.getElementById("<%= editor1.ClientID %>");
        function checkIsDirty() {
            if (editor1.IsDirty()) {
                //set_updated()  
                alert("is dirty");
            }
        }
        function CuteEditor_OnChange(editor) {
            checkIsDirty();
        }  
    </script>
    Thank you for asking
    Eric@cutesoft.net  
  •  12-06-2010, 5:10 PM 65300 in reply to 65297

    Re: problem in IsDirty

    thx Eric,
    I can run the code and understand it
    but it's still not right in firefox!
    if I just click in the editor without changing anything there, the isDirty is still "true". That's not right as the user doesn't change anything.
  •  12-13-2010, 4:17 PM 65356 in reply to 65300

    Re: problem in IsDirty

    can anyone pls help?
  •  12-13-2010, 4:17 PM 65357 in reply to 65300

    Re: problem in IsDirty

    can anyone pls help?
  •  12-13-2010, 4:18 PM 65358 in reply to 65300

    Re: problem in IsDirty

    can anyone pls help?
  •  12-13-2010, 11:48 PM 65363 in reply to 65277

    Re: problem in IsDirty

    Hi,
     
    Currently for most cases , the editor is not able to prevent this issue.
     
    We will fix this issue in next version.
     
    Regards,
    Terry
View as RSS news feed in XML