Here is the weird part. When I try to open my form (when I'm using UpdatePanels), I'm getting an error here:
function ValidatorOnLoad() {
if (typeof(Page_Validators) == "undefined")return;
var i, val;for (i = 0; i < Page_Validators.length; i++) {
val = Page_Validators[i];
if (typeof(val.evaluationfunction) == "string") { // The error is on this line
eval(
"val.evaluationfunction = " + val.evaluationfunction + ";");
}
In the debugger I see that I have 16 validators, but for some reason the 3rd [2] validator is null. I could not figure out what could be the problem.
The null validator is between FirstName, LastName validators and DOB validator.
Here is the UserControl ASPX definition:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="GeneralInfo.ascx.cs" Inherits="Coordinator_UCD_GeneralInfo" Description = "General Information Tab" %>
<%
--<%@ Register src="DateCombo.ascx" tagname="DateCombo" tagprefix="uc1" %>--%>
<%
@ Register Assembly="RJS.Web.WebControl.PopCalendar" Namespace="RJS.Web.WebControl" TagPrefix="rjs" %><asp:Panel ID="pnlIsActive" runat="server" BorderStyle="None" Visible="False"
CssClass ="cl" Width = "100%">
<
label class="bx">Active</label>
<span class="bx" style="width: 20px"><asp:CheckBox ID="chkActive"
runat="server" /></span></asp:Panel>
<
div class="cl"><label class="bx">First Name </label><span class="bx"><asp:TextBox ID="txtFirstName" Text='' MaxLength="25" runat="server"/>
<
asp:RequiredFieldValidator ID="rqfvFirstName" runat="server" ControlToValidate="txtFirstName" ErrorMessage="First Name is Required" Display="Dynamic"></asp:RequiredFieldValidator></span><label class="bx">Middle Name </label><span class="bx"><asp:TextBox ID="txtMiddleName" Text='' MaxLength="25" runat="server"/></span>
<
label class="bx">Last Name </label><span class="bx"><asp:TextBox ID="txtLastName" Text='' MaxLength="30" runat="server"/>
<
asp:RequiredFieldValidator ID="rqfvLastName" runat="server"
ControlToValidate
="txtLastName" ErrorMessage="Last Name is Required" Display="Dynamic"></asp:RequiredFieldValidator></span></div>
<
asp:Panel ID="pnlTitle" runat="server" BorderStyle="None" Visible="False" CssClass ="cl" Width = "100%">
<
label class="bx">Title </label><span class="bx">
<
asp:TextBox ID="txtTitle" runat="server" AutoCompleteType="Disabled" MaxLength="50" Text=''></asp:TextBox>
<
asp:RequiredFieldValidator ID="rqfvTitle" runat="server" ControlToValidate="txtTitle" Display="Dynamic" Visible = "false"
ErrorMessage="Title is Required"></asp:RequiredFieldValidator></span></asp:Panel>
<
div class="cl"><label class="bx">Gender</label><span class="bx"><asp:DropDownList ID="ddlGender" runat="server" CssClass="gndr" ToolTip="Select Gender"
onSelectedIndexChanged="OnGenderChanged"><asp:ListItem Value="M">Male</asp:ListItem>
<
asp:ListItem Value="F">Female</asp:ListItem></asp:DropDownList></span>
</
div><%--<div class="cl">
<asp:Panel ID="pnlDOB" runat="server" BorderStyle="None"
CssClass ="cl" Width = "100%">
<label class="bx">Date of Birth</label>
<span class="bx dob"><uc1:DateCombo ID="dcDOB" PopulateOnPostBack="true" runat="server" /></span></asp:Panel>
</div>--
%><div class="cl">
<
label class="bx">Date of Birth</label><span class="bx dob">
<
asp:TextBox ID="txtDOB" AutoCompleteType="disabled" TextMode="SingleLine" runat="server" />
<rjs:PopCalendar ID="popcalDOB" runat="server" BorderWidth="" Language="" SelectedDate=""control="txtDOB" Fade="1" Format="m d yyyy" Separator="/" />
<
asp:RequiredFieldValidator ID="rqfvDOB" runat="server" ControlToValidate="txtDOB" ErrorMessage="Date of Birth is Required" Display="Dynamic"></asp:RequiredFieldValidator>
<
asp:RegularExpressionValidator ID="regexDoB" runat="server" ControlToValidate="txtDOB"
Display
="Dynamic" ErrorMessage="Incorrect Date of Birth (m/d/yyyy)" ValidationExpression="(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[13-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2})"></asp:RegularExpressionValidator>
</span></div>
<
div class="cl"><asp:Panel ID="pnlParents" runat="server" BorderStyle="None"
Width="100%" Height="65px" HorizontalAlign ="Left" >
<
label class="bx">
Father
</label>
<
span class="bx"><asp:TextBox ID="txtFather" runat="server" AutoCompleteType="Disabled"
MaxLength="100" Text=''></asp:TextBox></span>
<
label class="bx">
Father Cell
</label>
<
span class="bx"><asp:TextBox ID="txtFatherCell" runat="server" AutoCompleteType="Disabled"
MaxLength="25" Text=''></asp:TextBox>
<%--<asp:RegularExpressionValidator ID="regexvlFatherCell" runat="server"
ControlToValidate="txtFatherCell" Display="Dynamic" Enabled ="false"
ErrorMessage="Incorrect Cell Phone"
ValidationExpression="(\([2-9]\d{2}\)\s?|[2-9]\d{2}-|[2-9]\d{2}\s?)[1-9]\d{2}(-|\s)?\d{4}\s?(([xX]|[eE][xX][tT])(#|:)?\s?\d+)?"></asp:RegularExpressionValidator>--%>
</span><br /><br />
<
label class="bx">
Mother
</label>
<
span class="bx"><asp:TextBox ID="txtMother" runat="server" AutoCompleteType="Disabled"
MaxLength="100" Text=''></asp:TextBox></span>
<
label class="bx">
Mother Cell
</label>
<
span class="bx"><asp:TextBox ID="txtMotherCell" runat="server" AutoCompleteType="Disabled"
MaxLength="25" Text=''></asp:TextBox>
<%--<asp:RegularExpressionValidator ID="regexvlMotherCell" runat="server"
ControlToValidate="txtMotherCell" Display="Dynamic" enabled ="false"
ErrorMessage="Incorrect Cell Phone"
ValidationExpression="(\([2-9]\d{2}\)\s?|[2-9]\d{2}-|[2-9]\d{2}\s?)[1-9]\d{2}(-|\s)?\d{4}\s?(([xX]|[eE][xX][tT])(#|:)?\s?\d+)?"></asp:RegularExpressionValidator>--%>
</span>
</
asp:Panel></div>
I see nothing's wrong here, so I don't understand where this null validator is coming from... And since this is auto-generated code I have no control over it.
The only solution is to comment out all update panels. Then the page works correctly, but I get the whole page refresh - that's the downside.
I don't have the same problem in FireFox. I think in FireFox this error is just silently ignored.