Re: Strange error after taking the focus out of the CuteEditor

  •  02-19-2008, 10:15 AM

    Re: Strange error after taking the focus out of the CuteEditor

    Thanks for your reply Adam. I'm already using that function 
     
    I talked with support and they told me to reproduce the error in an example page.
    Here is a simple test page showing the error, I want to focus on the editor after a tab on the textfield (not working well in this example, use "S" instead), and after the user press ctrl+tab on the cute editor I want the focus back into the text editor.
     
    When you press control tab inside the  cute editor I get an exception. I want just to get the focus back in the text field.
    Thanks for your help.
     
    Here is the test case, please give it a try.
     
     
    <%@ Page Language="C#" AutoEventWireup="true" %>
    <%@ Register TagPrefix="ce" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>



    <script type="text/jscript">
    var editor = null;



    function onBodyLoad(){

        document.getElementById("Text1").focus();
        window.setTimeout("iniCuteEditor()",1000);

    }
     

     function iniCuteEditor()
        {  
           editor = document.getElementById('<% = Editor.ClientID%>');     
           var editdoc=editor.GetDocument();
                // attach Event
            editdoc.attachEvent('onkeydown',cuteEditorOnkeyDown);
             document.getElementById("Text1").focus();
        }


    function cuteEditorOnkeyDown(e)
        {
                        
            if (event) e = event;    
            
            if (e.ctrlKey && e.keyCode == 9) //Tab+Ctrl?
            {    
             document.getElementById("Text1").focus();
            }    
                
            
        }

    function textKeyDown(){

        //debugger;
        if(event.keyCode == 9 || event.keyCode==83) //tab? or S
            {
                 editor = document.getElementById('<%=Editor.ClientID%>');
                editor.FocusDocument();
                event.cancelBubble =true;
                return false;
        
            }


    }

    </script>

    </head>

    <body onkeydown="" onload="onBodyLoad()">
        <form id="form1" runat="server">
        <div>
        
        test &nbsp;<input id="Text1" type="text" onkeydown="textKeyDown();" />
        <br/><br/>
        
        <CE:Editor id="Editor" runat="server" Width="720px" Height="250px" ShowBottomBar="false" UseHTMLEntities="true">
                </CE:Editor>
            <br />
            </div>
        </form>
    </body>
    </html>

     
View Complete Thread