[CLOSED] How To Focus TextArea

  1. #1

    [CLOSED] How To Focus TextArea

    Hi,

    can help to focus the textarea, so the cursor will automatically in the text area?
    Eventhou i already use autofocus property, still unable to focus.

    thanks

    aspx
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <div>
        
        <ext:Button ID="Button_Other_ReportList_Tag" runat="server" Text="show" >
            <Listeners>
                <Click Handler="Ext.net.DirectMethods.ShowWindow();" />
            </Listeners>
        </ext:Button>
        
        <ext:Window ID="winResultTaggingComment" runat="server" Hidden="true" Modal="true" Border="false" Closable="true" Width="500" Height="500" Title="Comments History">
        </ext:Window>
        
        </div>
    aspx.cs
            protected void Page_Load(object sender, EventArgs e)
            {
                UserControl uc1 = (UserControl)this.LoadControl("UserControl.ascx");
                winResultTaggingComment.ContentControls.Add(uc1);
            }
    
            [Ext.Net.DirectMethod]
            public void ShowWindow()
            {
                this.winResultTaggingComment.Show();
            }
    ascx
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UserControl.ascx.cs" Inherits="ExtNetTest.UserControl" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <ext:Panel ID="PanelHorizontalLine_ResultTagging" runat="server" Height="5">
        <Content>
            blablabla
        </Content>
    </ext:Panel>
    
    
    <ext:Panel ID="PanelComment_ResultTaggingComment" runat="server" LabelAlign="Top" Layout="Form" Height="100">
        <Items>
            <ext:TextArea ID="TextArea_ResultTaggingComment" runat="server" FieldLabel="Comment(s)" AnchorHorizontal="100%" Height="75" AllowBlank="false" InvalidClass="x" AutoFocus="true" AutoFocusDelay="10">
            </ext:TextArea>
        </Items>
    </ext:Panel>
    Last edited by Daniil; Aug 07, 2012 at 4:55 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Confirm, AutoFocus can't manage such scenario.

    I can suggest to use the following AfterRender listener of the TextArea.

    Example
    <AfterRender Handler="this.findParentByType('window').on(
                              'show', 
                              function () { 
                                  this.focus(this.selectOnFocus || false, 100); 
                              }, 
                              this);" />

Similar Threads

  1. [CLOSED] Textarea linefeed
    By CarWise in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 19, 2012, 3:33 PM
  2. [CLOSED] Validation for TextArea
    By majestic in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 22, 2010, 12:26 PM
  3. [CLOSED] MaxLength fix for TextArea
    By jsemple in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 09, 2009, 5:49 PM
  4. [CLOSED] wrapping in textarea
    By gokcemutlu in forum 1.x Legacy Premium Help
    Replies: 13
    Last Post: Sep 04, 2009, 4:37 AM
  5. [CLOSED] BUG in <ext:TextArea in version 0.6
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 09, 2008, 10:33 AM

Posting Permissions