PDA

View Full Version : [CLOSED] Dynamic form blur listener not firing in IE 9 and above...



rthiney
Feb 12, 2013, 3:45 PM
Hi,
I've created a dynamic form, and added a listener on the blur event of the fields that are created.
The javascript is called fine from Chrome, but not IE 9 and above..

Here is the code that creates the form:


[DirectMethod]
public void RecreateForm(object o, DirectEventArgs e)
{
string[] date = e.ExtraParams["dateInfo"].Split(new string[] { "-" }, StringSplitOptions.None);
int portfolioId = Convert.ToInt32(this.hidPortfolioId.Text);




PortfolioCompany co = PortfolioCompany.SingleOrDefault(oo => oo.PortfolioCompanyId.Equals(portfolioId));
WPDBDB db = new WPDBDB();


var titles = db.FinancialResultGrid(Convert.ToInt32(this.hidPor tfolioId.Text), Convert.ToInt32(date[0].Replace("Q", string.Empty)), Convert.ToInt32(date[1])).ExecuteTypedList<FinancialResultGridResult>();


var form = new FormPanel
{
ID = "FormTaskPanel1",
// RenderFormElement = false,
Border = false,
AutoScroll = true,
// LabelWidth = 150,
// LabelAlign = LabelAlign.Left,
Padding = 5
};
foreach (var title in titles)
{
if (!title.IsCalc)
{
NumberField df = new NumberField();
df.FieldLabel = title.Title;
df.ID = "Control_" + title.PortfolioPerformanceTitleId.ToString();
df.Value = (title.Value == null) ? string.Empty : title.Value.ToString();
df.LabelStyle = (title.IsCalc) ? "font-style:italic;padding-left:8px" : "";
hidControlIds.Text += title.PerformanceDataId.ToString() + ":";
df.IDMode = IDMode.Explicit;
df.Listeners.Blur.Handler = string.Format("ClientSaveChanges(this.value,{0},{1});", (title.PerformanceDataId != null) ? title.PerformanceDataId.ToString() : "0", title.PortfolioPerformanceTitleId);
form.Items.Add(df);
}
}
this.pnl.Items.Clear();
form.Render(this.pnl, RenderMode.AddTo);
}


Is there a better way to handle this event that is more cross browser compliant?

Daniil
Feb 12, 2013, 5:06 PM
Hi @rthiney,

I am unable to reproduce with a test case below. Please provide your full (but simplified) test case.

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void RenderFormPanel(object sender, DirectEventArgs e)
{
FormPanel f = new FormPanel()
{
Items =
{
new TextField()
{
Listeners =
{
Blur =
{
Handler = "console.log('blur');"
}
}
}
}
};

f.Render(this.Panel1, RenderMode.AddTo);
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:Button runat="server" Text="Render FormPanel" OnDirectClick="RenderFormPanel" />

<ext:Panel
ID="Panel1"
runat="server"
Width="300"
Height="300"
Layout="FitLayout" />

</form>
</body>
</html>