Nov 12, 2010, 5:59 PM
[CLOSED] EventMask for button click not blocking button when enter key is pressed
I'm facing the following problem in my application: I have a login page, in which there is a button with a click directevent. This direct event calls a method in which, if the user's name and password are correct, i redirect him to the main page of the website. For this directevent i use eventmask, so when the focus is on the button and the user presses enter, the button should not fire it's click direct event again until there is a response from the server. There is the problem: if the user presses enter with the focus on the button a lot of times very rapidly (or if you press enter holding it with focus on the button), the event is fired a lot of times, generating a lot of requests, and then user is presented with an error screen (only in firefox) for a brief moment, before he finally gets redirected. Here is the error screen:
And here is a piece of code to reproduce it. Just hold enter above the button, and the error message will be shown for a few seconds before the page finally gets redirected to google, in the case of the example:
The error screen is shown only in firefox, but i guess the error happens in IE8 also. The problem with the style happens in both browsers.
Please, tell me if i didn't make myself clear.
And here is a piece of code to reproduce it. Just hold enter above the button, and the error message will be shown for a few seconds before the page finally gets redirected to google, in the case of the example:
<%@ Page Language="C#" AutoEventWireup="true"%>
<%@ 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">
<script runat="server">
protected override void OnLoad(EventArgs e)
{
btDirectEvent.Focus();
btDirectEvent.DirectEvents.Click.Event += new ComponentDirectEvent.DirectEventHandler(Click_Event);
btDirectEvent.DirectEvents.Click.EventMask.ShowMask = true;
base.OnLoad(e);
}
void Click_Event(object sender, DirectEventArgs e)
{
Response.Redirect("http://www.google.com");
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ext:ResourceManager ID="ResourceManager" runat="server" />
<ext:Button runat="server" ID="btDirectEvent"></ext:Button>
</div>
</form>
</body>
</html>
There is another problem, that would be hard to reproduce, so i'm not sending an example reproducing it: In both my login and my main page (the page to which the user is redirected after logging in, i call the following piece of code, to change the style to gray:Session["Ext.Net.Theme"] = Ext.Net.Theme.Gray;
Then, in my main page, i have a menu. When one of the items of the menu is clicked, i load a page as a frame into a tabpanel. Both the pages shown in the tabpanel and the menu, when the error described above NOT happens, are shown with the correct gray style, since they're in the same session. When, and only when, the above error happens, the menu is loaded with the correct gray style, but the pages loaded in the tabpanels are loaded with the default blue style, don't know why. It's not losing the session, because i use more stuff of the session in these pages, and they are loaded normally, the only problem being the wrong blue style.The error screen is shown only in firefox, but i guess the error happens in IE8 also. The problem with the style happens in both browsers.
Please, tell me if i didn't make myself clear.
Last edited by Daniil; Nov 22, 2010 at 11:22 PM.
Reason: [CLOSED]