This is a migrated thread and some comments may be shown as answers.

Focus not working

3 Answers 185 Views
Editor
This is a migrated thread and some comments may be shown as answers.
HSLaw
Top achievements
Rank 1
HSLaw asked on 30 Sep 2008, 03:57 AM
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



3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 02 Oct 2008, 11:03 AM
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.
0
HSLaw
Top achievements
Rank 1
answered on 03 Oct 2008, 02:25 AM
Thanks.
I have submited the support ticket.
ID: 165557
0
Rumen
Telerik team
answered on 03 Oct 2008, 12:53 PM
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.
Tags
Editor
Asked by
HSLaw
Top achievements
Rank 1
Answers by
Rumen
Telerik team
HSLaw
Top achievements
Rank 1
Share this question
or