Mar 29, 2012, 5:27 PM
[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
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]