Sep 02, 2011, 7:17 PM
Pressing Enter in a TextField from FormPanel2 will submit FormPanel1
Hello guys, I found myself in the following scenario:
Two FormPanels in the same Page. Each one has its own Button[type=Submit] with a DirectEvent configured to treat its data.
The problem is when I press "Enter" inside the TextField from FormPanel2 (Txt2), the DirectEvent for FormPanel1 is called.
In the testcase below you can easily see this behaviour when the EventMask appears.
I know I can remove type=submit from buttons and add KeyPress listeners on textfields to track e.ENTER and e.NUM_CENTER, and then fireEvent('click') in the correct button. I just dont think this is the right solution.
I'm running Ext.Net community v1.1.
Two FormPanels in the same Page. Each one has its own Button[type=Submit] with a DirectEvent configured to treat its data.
The problem is when I press "Enter" inside the TextField from FormPanel2 (Txt2), the DirectEvent for FormPanel1 is called.
In the testcase below you can easily see this behaviour when the EventMask appears.
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Btn1_Click(object sender, DirectEventArgs e)
{
}
protected void Btn2_Click(object sender, DirectEventArgs e)
{
}
</script>
<!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>Untitled Paged</title>
</head>
<body>
<ext:ResourceManager runat="server" ID="ResourceManager1" />
<form id="form1" runat="server">
<ext:FormPanel runat="server" ID="FormPanel1" Title="FormPanel1" Frame="true" Width="200">
<Items>
<ext:TextField runat="server" ID="Txt1" />
</Items>
<Buttons>
<ext:Button runat="server" ID="Btn1" Type="Submit" Text="Submit Form 1">
<DirectEvents>
<Click OnEvent="Btn1_Click">
<EventMask ShowMask="true" MinDelay="500" CustomTarget="FormPanel1" />
</Click>
</DirectEvents>
</ext:Button>
</Buttons>
</ext:FormPanel>
<ext:FormPanel runat="server" ID="FormPanel2" Title="FormPanel2" Frame="true" Width="200">
<Items>
<ext:TextField runat="server" ID="Txt2" />
</Items>
<Buttons>
<ext:Button runat="server" ID="Btn2" Type="Submit" Text="Submit Form 2">
<DirectEvents>
<Click OnEvent="Btn2_Click">
<EventMask ShowMask="true" MinDelay="500" CustomTarget="FormPanel2" />
</Click>
</DirectEvents>
</ext:Button>
</Buttons>
</ext:FormPanel>
</form>
</body>
</html>
I know I can remove type=submit from buttons and add KeyPress listeners on textfields to track e.ENTER and e.NUM_CENTER, and then fireEvent('click') in the correct button. I just dont think this is the right solution.
I'm running Ext.Net community v1.1.
Last edited by arkilus; Sep 02, 2011 at 7:26 PM.