Jul 09, 2013, 2:19 AM
How to Press Enter in TextField to Login
HI friends,
I'm using Ext.net 2.0. Then I found a issue as the title. I tried search answer but get none. Below is my code and the enviroment.
First of all, Login form work properly when clicking the LOGIN button.
JS Code:
I'm using Ext.net 2.0. Then I found a issue as the title. I tried search answer but get none. Below is my code and the enviroment.
First of all, Login form work properly when clicking the LOGIN button.
JS Code:
<script type="text/javascript">
var EnterPressHandler = function (field, e) {
if (e.getKey() == Ext.EventObject.ENTER) {
Ext.getCmp("btnLogin").fireEvent("click", Ext.getCmp("btnLogin"));
}
}
</script>
aspx code:<ext:TextField EnableKeyEvents="true" runat="server" FieldLabel="Password" AllowBlank="false" BlankText="Required" ID="txtPassword" InputType="Password">
<Listeners>
<SpecialKey Fn="EnterPressHandler"></SpecialKey>
</Listeners>
</ext:TextField>
When press Enter in the password TextField, it do fire a 'click' event to the btnLogin button, I can see the MaskMsg, but has different behavior as Directly Clicking the btnLogin Button which will login correctly. I don't know the reason. Pls. help me. Thank you.