[CLOSED] Textfield losing focus when button is enabled

  1. #1

    [CLOSED] Textfield losing focus when button is enabled

    Hi,

    I have a textfield on a window but whenever I enable a button on the form while i am typing in the textfield the textfield loses focus. How can this issue be resolved. The same issue was happening on the numerfield on the page and I had to call setfocus() on the numberfield to resolve that. But calling setfocus() on the tetfield sets the input to the begining of the text not to the end of the text.

    Below is by aspx page

    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl< RCM.Monitor.Client.Areas.ServerConfiguration.Models.AddServerViewModel>" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <ext:Window ID="winAddServer" runat="server" Title='<%# Model.Title %>' Icon="Wrench"
        Modal="true" Height="205" Width="300" Layout="fit" Hidden="false" Resizable="false"
        IDMode="Explicit" AutoDataBind="true" Closable="true">
        <Items>
            <ext:Panel runat="server" BodyStyle="padding:20px 15px 20px 15px" Border="false"
                Header="false" Layout="Form" LabelAlign="Top">
                <Defaults>
                    <ext:Parameter Name="AllowBlank" Value="false" Mode="Raw" />
                    <ext:Parameter Name="MsgTarget" Value="side" />
                </Defaults>
                <Items>
                    <ext:Panel runat="server" Border="false" Header="false" Layout="Form" LabelAlign="Top"
                        Cls="routingServerPanel">
                        <Items>
                            <ext:Hidden runat="server" Text='<%# Model.Type %>' IDMode="Explicit" ID="typeField"
                                AutoDataBind="true">
                            </ext:Hidden>
                            <ext:TextField ID="txtMachineNameAddServer" runat="server" 
                            IDMode="Explicit" FieldLabel="<%$ Resources:WebResources|ServerConfiguration.FormLabels, MachineNameTextFieldText %>"
                                Cls="highlight" EnableKeyEvents="true" TabIndex="10" AnchorHorizontal="100%">
                                <Listeners>                               
                                    <KeyUp Handler="AddServerWindow.EnableApplyButton();" />                                                    
                                </Listeners>
                            </ext:TextField>
                            <ext:NumberField ID="txtPortAddServer" runat="server" FieldLabel="<%$ Resources:WebResources|ServerConfiguration.FormLabels, PortText %>"
                                Cls="highlight" EnableKeyEvents="true" TabIndex="11"  AnchorHorizontal="100%"
                                IDMode="Explicit">
                                <Listeners>                                
                                    <KeyUp Handler="AddServerWindow.EnableApplyButton();this.focus();" />
                                </Listeners>
                            </ext:NumberField>
                        </Items>
                    </ext:Panel>
                </Items>
            </ext:Panel>
        </Items>
        <Buttons>
            <ext:Button ID="btnApplyAddServer" runat="server" Text="<%$ Resources:WebResources|Common.FormLabels, Apply %>" TabIndex="13"
                AnchorHorizontal="100%" Disabled="true" IDMode="Explicit">
                <Listeners>               
                </Listeners>
            </ext:Button>
            <ext:Button runat="server" Text="<%$ Resources:WebResources|Common.FormLabels, Close %>" TabIndex="14"
                AnchorHorizontal="100%" IDMode="Explicit">
                <Listeners>
                    <Click Handler="winAddServer.hide()" />          
                </Listeners>
            </ext:Button>
        </Buttons>
        <Tools>
            
        </Tools>
    
    </ext:Window>
    the enable button is setting btnApplyAddServer.setDisabled(false);
    Last edited by Daniil; Apr 06, 2012 at 10:00 AM. Reason: [CLOSED]
  2. #2
    Hi,

    I was unable to reproduce with the example below.

    Please provide your runnable test case.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!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>Ext.NET Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:TextField runat="server" EnableKeyEvents="true">
            <Listeners>
                <KeyUp Handler="Button1.setDisabled(false);" />
            </Listeners>
        </ext:TextField>
        <ext:Button ID="Button1" runat="server" Text="Button" Disabled="true" />
    </body>
    </html>

Similar Threads

  1. [CLOSED] Button Enabled in code behind
    By CMA in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Aug 01, 2013, 5:18 AM
  2. Replies: 2
    Last Post: Aug 28, 2012, 10:26 AM
  3. [CLOSED] [1.0] - Toolbar Button looks enabled when Disabled = true
    By drkoh in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 01, 2010, 5:36 PM
  4. Focus on Textfield
    By hans4 in forum 1.x Help
    Replies: 2
    Last Post: Jul 02, 2009, 9:08 PM
  5. [CLOSED] Button enabled?
    By MrMp3 in forum 1.x Help
    Replies: 4
    Last Post: Sep 19, 2008, 1:15 PM

Posting Permissions