May 07, 2013, 7:27 AM
[CLOSED] How to prevent clear textfield after keyboard ENTER was down
Hi,
Like in Title. Here is my code:
Another question is there a way to bind a key to entire form?
Thanks,
ViDom
Like in Title. Here is my code:
<ext:Container ID="containerLogin" runat="server" Layout="Fit" Width="450" Height="180" StyleSpec="margin:140px auto;" HideBorders="True">
<Items>
<ext:FormPanel
ID="Window1"
runat="server"
Resizable="false"
MinHeight="150"
MaxHeight="200"
Icon="Lock"
Title="Log"
Width="450"
Cls="login-form"
Padding="5" >
<Items>
<ext:TextField
ID="txtUsername"
runat="server"
FieldLabel="Login <span class='red'>*</span>"
AllowBlank="false"
BlankText="Login is required."
/>
<ext:TextField
ID="txtPassword"
runat="server"
InputType="Password"
FieldLabel="Password <span class='red'>*</span>"
AllowBlank="false"
BlankText="Password is required."
EnableKeyEvents="True"
>
<Listeners>
<KeyPress Handler="if(e.getKey() == Ext.EventObject.ENTER){e.stopEvent();#{LoginButton}.fireEvent('click');}" />
</Listeners>
</ext:TextField>
<ext:Checkbox
runat="server"
ID="chRemember"
Checked="False"
FieldLabel="Remember login and password"
></ext:Checkbox>
</Items>
<Buttons>
<ext:Button ID="LoginButton" runat="server" Icon="Accept" Text="Log In">
<DirectEvents>
<Click Before="if(!#{txtUsername}.validate()||(!#{txtPassword}.validate()|| #{txtUsername}.disabled)){ #{myStatus}.Hide(); return false;}">
<ExtraParams>
<ext:Parameter runat="server" Name="Resolution" Value="Ext.getBody().getViewSize()" Mode="Raw" Encode="True"></ext:Parameter>
</ExtraParams>
<EventMask Target="CustomTarget" CustomTarget="#{Window1}" Msg="Please wait..." ShowMask="True"></EventMask>
</Click>
</DirectEvents>
</ext:Button>
</Buttons>
</ext:FormPanel>
</Items>
</ext:Container>
What should I change to prevent clear textFiled.Text in txtLogin as well as txtPassword?Another question is there a way to bind a key to entire form?
Thanks,
ViDom
Last edited by Daniil; May 09, 2013 at 1:39 PM.
Reason: [CLOSED]