[CLOSED] Have a HTML Editor in window, want to give focus and put cursor at end of content...

  1. #1

    [CLOSED] Have a HTML Editor in window, want to give focus and put cursor at end of content...

    .focus() doesn't seem to work.

    Is there any solid work around? I tried just about everything I found here in forum...

    I just want the cursor to be at the end of the content, ready for user to type...

    Thanks
    Last edited by Daniil; Apr 03, 2014 at 4:09 AM. Reason: [CLOSED]
  2. #2
    Ya, for some reason calling .focus() does not appear to work. We will have to try and fix.

    Thanks for the report.
    Geoffrey McGill
    Founder
  3. #3
    Hi everybody,

    It appears to be working in this scenario. Tested on FireFox.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:Window ID="Window1" runat="server" Hidden="true" DefaultFocus="HtmlEditor1">
                <Items>
                    <ext:HtmlEditor ID="HtmlEditor1" runat="server" />
                </Items>
            </ext:Window>
            
            <ext:Button runat="server" Text="Show" Handler="App.Window1.show();" />
        </form>
    </body>
    </html>
  4. #4
    Quote Originally Posted by Daniil View Post
    It appears to be working in this scenario. Tested on FireFox.
    Try and just call .focus() on the HtmlEditor.

    App.HtmlEditor1.focus();
    Geoffrey McGill
    Founder
  5. #5
    From a JavaScript console of a browser? Yes, it appears to be not working if call from FireBug. Maybe, FireBug takes focus back. I am not sure.

    It appears to work in this example.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:HtmlEditor ID="HtmlEditor1" runat="server" />
    
            <ext:TextField ID="TextField1" runat="server" />
    
            <ext:Button runat="server" Text="Focus HtmlEditor" Handler="App.HtmlEditor1.focus();" />
    
            <ext:Button runat="server" Text="Focus TextField" Handler="App.TextField1.focus();" />
        </form>
    </body>
    </html>
  6. #6
    Quote Originally Posted by Daniil View Post
    Maybe, FireBug takes focus back. I am not sure.
    Yes, that does appear to be the case.

    Now, place cursor at the end.
    Geoffrey McGill
    Founder
  7. #7
    Quote Originally Posted by geoffrey.mcgill View Post
    Now, place cursor at the end.
    Do you mean that the cursor is not placed at the end in my example?

Similar Threads

  1. get editor html content
    By Ahmad in forum 1.x Help
    Replies: 2
    Last Post: May 22, 2013, 4:33 PM
  2. [CLOSED] HTML Editor Cursor
    By RCM in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Sep 21, 2012, 11:17 PM
  3. [CLOSED] Html editor on focus
    By nirajrdave in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Mar 29, 2012, 10:18 AM
  4. [CLOSED] HTML EDITOR - Insert Value in last location of cursor
    By nirajrdave in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 23, 2012, 4:58 AM
  5. [CLOSED] Have cell, want to trigger editor and give focus...
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 21, 2011, 6:01 PM

Posting Permissions