PDA

View Full Version : [FIXED] [V0.7] RequiredFieldValidator Bug



Timothy
Oct 03, 2008, 6:22 PM
Hello,

Run the following example and switch tabs and note the JS error in FireBug.

Example.aspx:


<%@ Page Language="C#" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" 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 OnInit(EventArgs e)
{
Control control = Page.LoadControl("Example-Control.ascx");

UserControl.Controls.Add(control);

base.OnInit(e);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" />
<ext:ScriptManager ID="ScriptManager2" runat="server" StateProvider="PostBack" />
<ext:ViewPort ID="ViewPort1" runat="server" Stateful="True">
<Content>
<ext:BorderLayout ID="BorderLayout1" runat="server" RenderHidden="True">
<North Collapsible="True" Split="True">
<ext:Panel ID="North" runat="server" Border="False" Height="173px">
<Content>
<p><a href="Example.aspx">Reload</a></p>
</Content>
</ext:Panel>
</North>
<West Split="True">
<ext:Panel ID="West" runat="server" Title="Menu" Width="300">
<Content>
West
</Content>
</ext:Panel>
</West>
<Center Split="True">
<ext:Panel ID="Center" runat="server" Border="False">
<Content>
<ext:Panel ID="pnlControl" runat="server" AutoScroll="True">
<Content>
<asp:UpdatePanel ID="UpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:PlaceHolder ID="UserControl" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</Content>
</ext:Panel>
</Content>
</ext:Panel>
</Center>
</ext:BorderLayout>
</Content>
</ext:ViewPort>
</form>
</body>
</html>


Example-Control.ascx:


<%@ Control Language="C#" ClassName="Example_Control" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Permissions.DataSource = new object[] {
new object[] { 1, "Permission", "Permission 1" },
new object[] { 2, "Permission", "Permission 2" },
new object[] { 3, "Permission", "Permission 3" },
new object[] { 4, "Permission", "Permission 4" },
new object[] { 5, "Permission", "Permission 5" },
new object[] { 6, "Permission", "Permission 6" }
};
Permissions.DataBind();
}
</script>
<ext:Store ID="Permissions"
runat="server"
AutoLoad="True"
GroupField="GroupingName">
<Reader>
<ext:ArrayReader ReaderID="PermissionId">
<Fields>
<ext:RecordField Name="PermissionId" />
<ext:RecordField Name="GroupingName" />
<ext:RecordField Name="DisplayName" />
</Fields>
</ext:ArrayReader>
</Reader>
<SortInfo Field="DisplayName" />
</ext:Store>
<ext:TabPanel ID="TabPanel1" runat="server" AutoPostBack="True" DeferredRender="True">
<Tabs>
<ext:Tab ID="Tab1" runat="server" Title="Tab 1" AutoHeight="True">
<Content>
Tab 1
</Content>
</ext:Tab>
<ext:Tab ID="Tab2" runat="server" Title="Tab 2" AutoHeight="True">
<Content>
<ext:TextField ID="TextField1" runat="server" MaxLength="255" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextField1" ErrorMessage="TextField is a required field" Display="Dynamic" />
</Content>
</ext:Tab>
</Tabs>
</ext:TabPanel>


Cheers,
Timothy

Timothy
Oct 04, 2008, 7:25 PM
This appears to be a bug resurfacing from the past http://forums.ext.net/showthread.php?postid=1557.aspx

Let me know when corrected, very annoying right now ;)

Cheers,
Timothy

Timothy
Oct 05, 2008, 12:25 PM
Any update on this one? This one is holding me back.

(Sorry, don't mean to nag)

Cheers,
Timothy

Timothy
Oct 05, 2008, 2:58 PM
Was able to correct by changing the following:

ScriptManager.cs SweepControls (line 156)

From:


protected override void SweepControls(WebControl item)
{
base.SweepControls(item);

if (!Ext.IsAjaxRequest &amp;&amp; !this.isValidationFixRegistered)
{
if (this.Page.Form != null)
{
...


To:


protected override void SweepControls(WebControl item)
{
base.SweepControls(item);

if (!Ext.IsMicrosoftAjaxRequest &amp;&amp; !Ext.IsAjaxRequest &amp;&amp; !this.isValidationFixRegistered)
{
if (this.Page.Form != null)
{
...

Timothy
Oct 14, 2008, 6:58 PM
Status? This one is still causing issues right out of SVN.

Cheers,
Timothy

geoffrey.mcgill
Nov 04, 2008, 10:11 AM
Hi Timothy,

I added a small JavaScript tweak which should fix this problem.


Your sample now works unchanged. 


Please SVN update, test and let us know if you're still running into issues. 


Hope this helps.

Timothy
Nov 04, 2008, 10:35 AM
Confirmed resolved.

Cheers,
Timothy