Support forums
in

onblur event for cute editor

Last post 03-26-2012, 8:00 AM by Kenneth. 3 replies.
Sort Posts: Previous Next
  •  03-23-2012, 8:50 AM 73545

    onblur event for cute editor

    Hi All,

    How can i add blur event for cute editor control?, if u have nay samples please update






    Many Thanks
    Ramesh durai
  •  03-23-2012, 10:38 AM 73547 in reply to 73545

    Re: onblur event for cute editor

    Hi Rameshdurai,
     
    Please try the example below, it shows you how to catch the focus/blur function of editor.
     
    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. <html xmlns="http://www.w3.org/1999/xhtml">  
    6. <head id="Head1" runat="server">  
    7.     <title>example</title>  
    8. </head>  
    9. <body>  
    10.     <form id="form1" runat="server">  
    11.        <input type="text" id="text1" />  
    12.        <p>Please note that textbox text changes when the focus change </p>  
    13.         <CE:Editor ID="editor1" runat="server">  
    14.         </CE:Editor>  
    15.           
    16.     </form>  
    17. </body>  
    18. </html>  
    19.   
    20. <script>  
    21. var text1=document.getElementById("text1");  
    22. function CuteEditor_OnInitialized(editor)  
    23. {  
    24.     var editdoc = editor.GetDocument();  
    25.     //for ie  
    26.     if(document.attachEvent)  
    27.     {  
    28.       
    29.         editdoc.onfocusin=function()  
    30.         {  
    31.             text1.value="focus in";  
    32.         }  
    33.         editdoc.onfocusout=function()  
    34.         {  
    35.             text1.value="focus out";  
    36.         }  
    37.     }  
    38.     //for firefox, chrome  
    39.     else  
    40.     {  
    41.         editdoc.body.addEventListener("focus",focusIn,false);  
    42.         editdoc.body.addEventListener("blur",focusOut,false);  
    43.     }  
    44. }  
    45. function focusIn()  
    46. {  
    47.     text1.value="firefox in";  
    48. }  
    49. function focusOut()  
    50. {  
    51.     text1.value="firefox out";  
    52.  }  
    53. </script>  
    Regards,
     
    Ken 
  •  03-24-2012, 12:51 AM 73553 in reply to 73547

    Re: onblur event for cute editor

    Hi Ken,
    Thanks for your reply,
     
    alone above provided code works very fine.
     
    but, in my page i have 4 cute editors, then, how can set CuteEditor_OnInitialized() event separately for each
    cute editors?
     

    Many Thanks
    Ramesh durai
  •  03-26-2012, 8:00 AM 73559 in reply to 73553

    Re: onblur event for cute editor

    Hi Rameshdurai,
     
    Method CuteEditor_OnInitialized will set it for each editor. You can separate it by editor.id.
     
    Like the example below 
    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. <html xmlns="http://www.w3.org/1999/xhtml">    
    6. <head id="Head1" runat="server">    
    7.     <title>example</title>    
    8. </head>    
    9. <body>    
    10.     <form id="form1" runat="server">    
    11.        <input type="text" id="text1" />    
    12.        <p>Please note that textbox text changes when the focus change </p>    
    13.         <CE:Editor ID="editor1" runat="server">    
    14.         </CE:Editor>    
    15.            <CE:Editor ID="editor2" runat="server">    
    16.         </CE:Editor>    
    17.     </form>    
    18. </body>    
    19. </html>    
    20.     
    21. <script>    
    22. var text1=document.getElementById("text1");    
    23. function CuteEditor_OnInitialized(editor)    
    24. {    
    25.     var editdoc = editor.GetDocument();    
    26.     //for ie    
    27.     if(document.attachEvent)    
    28.     {    
    29.         
    30.         editdoc.onfocusin=function()    
    31.         {    
    32.             text1.value="focus in";    
    33.         }    
    34.         editdoc.onfocusout=function()    
    35.         {    
    36.             text1.value="focus out";    
    37.         }    
    38.     }    
    39.     //for firefox, chrome    
    40.     else    
    41.     {    
    42.         editdoc.body.addEventListener("focus",focusIn,false);    
    43.         editdoc.body.addEventListener("blur",focusOut,false);    
    44.     }    
    45. }    
    46. function focusIn()    
    47. {    
    48.     text1.value="firefox in";    
    49. }    
    50. function focusOut()    
    51. {    
    52.     text1.value="firefox out";    
    53.  }    
    54. </script>    
     
    Regards,
     
    Ken 
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems