Focus not working

4 posts, 0 answers
  1. HSLaw
    HSLaw avatar
    153 posts
    Member since:
    Jan 2006

    Posted 29 Sep 2008 Link to this post

    URL:
    http://www.alchemedia.com.my/inpageedit.aspx


    1. I have an editor in this page with display:none by default.
    2. When user click on the content, the editor will be displayed.
    3. When user click on outside, the editor should be hidden by using blur event.

    However, the blur event is not working if the editor textarea is not focused.

    I tried to use the code below but not working:

    var editor = GetRadEditor("<%=RadContent.ClientID%>");  
    editor.SetFocus();  


    Am I missing something? Thanks



  2. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 02 Oct 2008 Link to this post

    Hi Paladin,

    Could you please, isolate the problem in a simple working project and send us the code via the support ticketing system under your Client.net account? We will find what is causing the problem and do our best to provide a solution.

    Best regards,
    Rumen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. HSLaw
    HSLaw avatar
    153 posts
    Member since:
    Jan 2006

    Posted 02 Oct 2008 Link to this post

    Thanks.
    I have submited the support ticket.
    ID: 165557
  5. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 03 Oct 2008 Link to this post

    Hi Paladin,

    I tried to reproduce the reported problem with the following code, but unfortunately to no avail:

    <div id="lContent">Sample Content 123</div>
    <div style="display:none" id="tContent">
        <telerik:radeditor runat="server" ID="RadEditor1" OnClientLoad="OnClientLoad">
                <Content></Content>
        </telerik:radeditor>
    </div>
    <script type="text/javascript">
        var lContent, tContent;
        Sys.Application.add_init(AppInit);
        function AppInit(sender)
        {
            lContent = $get('lContent');
            tContent = $get('tContent');
       
            $addHandler(lContent, "click", lContent_Click);
        }

    function OnClientLoad(editor, args) {
    var element = document.all ? editor.get_document().body : editor.get_document();
    $telerik.addExternalHandler(element, "blur", function(e) {
        var labelUpdated;
        if (lContent.textContent == editor._contentArea.innerHTML)
            labelUpdated = false;
        else
            labelUpdated = true;
        var oValue = editor.get_html(true); //get the HTML content

        lContent.innerHTML = editor._contentArea.innerHTML;
        tContent.style.display = 'none';
        lContent.style.display = '';

        if (labelUpdated) {
            alert('Updating... ' + editor._contentArea.innerHTML);
           
        }
    });
    }

    function lContent_Click() {
     lContent.style.display = 'none';
     tContent.style.display = '';
     
     var editor = $find("<%=RadEditor1.ClientID%>"); //get a reference to RadEditor client object
     editor.setFocus(); //set the focus on the the editor
     editor.set_html(lContent.innerHTML);

    }
    </script>

    You can see how the code works on my side in the attached video. Am I missing something?

    Best regards,
    Rumen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top