我有一个表单页面,当我提交由null Page_Validators引起时,我收到错误。我查看了Page_Validators数组,前两项是null,但其余的是我在页面上的实际验证器。这些空值来自哪里?我需要摆脱它们,因为它们会破坏我的脚本。
这是完整的页面。我不确定导致这种情况的原因,所以我认为最好只包括所有内容:
<%@ Page Language="VB" MasterPageFile="~/wimco.master" AutoEventWireup="false" CodeFile="new_account.aspx.vb" Inherits="new_account" title="Wimco - New Account" %>
<asp:content ID="Content1" ContentPlaceHolderID="Main" Runat="Server">
<script type="text/javascript" src="/jscripts/formvalidation.js"></script>
<script language="javascript" type="text/javascript">
function XmasCheck01(sender, args)
{
var arr = document.aspnetForm.ctl00$Main$txtArrive01.value;
var nights = document.aspnetForm.ctl00$Main$ddlNights01.value;
var xmas = new Date(2008, 11, 15); // Dec 15th
var nyears = new Date(2009, 0, 1); // Jan 1st
var m;
var d;
var n = parseInt(nights);
var arrive = new Date();
arrive.setTime(Date.parse(arr));
var depart = new Date(arrive.getFullYear(), arrive.getMonth(), arrive.getDate() + n);
if(arrive<=nyears && arrive>=xmas && n<14)
args.IsValid = false;
else
args.IsValid = true;
};
function XmasCheck02(sender, args)
{
var arr = document.aspnetForm.ctl00$Main$txtArrive02.value;
var nights = document.aspnetForm.ctl00$Main$ddlNights02.value;
var xmas = new Date(2008, 11, 15); // Dec 15th
var nyears = new Date(2009, 0, 1); // Jan 1st
var m;
var d;
var n = parseInt(nights);
var arrive = new Date();
arrive.setTime(Date.parse(arr));
var depart = new Date(arrive.getFullYear(), arrive.getMonth(), arrive.getDate() + n);
if(arrive<=nyears && arrive>=xmas && n<14)
args.IsValid = false;
else
args.IsValid = true;
}
</script>
<asp:Panel ID="pnlNewUser" runat="server" Visible="true">
<div id="leftContent">
<h1>Setting Up Your Vacation Account</h1>
<p>Fill out the form below to customize your vacation search. Your preferences will be remembered each time you visit Wimco.
</p> <table cellspacing="0" cellpadding="10" align="center" style="position: relative; z-index: 100" id="form-table">
<tr>
<td align="right">* First Name:</td>
<td>
<asp:TextBox
ID="txtFirstName"
TextMode="SingleLine"
EnableViewState="True"
Columns="20"
MaxLength="48"
CssClass="iField"
Runat="Server"/>
<asp:RequiredFieldValidator runat="server" ID="FNReq"
ControlToValidate="txtFirstName"
ValidationGroup="NewUser"
Display="None"
ErrorMessage="<b>Required Field Missing</b><br />A first name is required." />
<ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="NReqE"
TargetControlID="FNReq"
HighlightCssClass="validatorCalloutHighlight" />
</td>
</tr>
<tr>
<td align="right">* Last Name:</td>
<td>
<asp:TextBox
ID="txtLastName"
TextMode="SingleLine"
EnableViewState="True"
Columns="20"
MaxLength="48"
CssClass="iField"
Runat="Server"/>
<asp:RequiredFieldValidator runat="server" ID="LNReq"
ControlToValidate="txtLastName"
ValidationGroup="NewUser"
Display="None"
ErrorMessage="<b>Required Field Missing</b><br />A last name is required." />
<ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="LNReqE"
TargetControlID="LNReq"
HighlightCssClass="validatorCalloutHighlight" />
</td>
</tr>
<tr>
<td align="right">* Email Address:</td>
<td>
<asp:TextBox
ID="txtNewEmail"
TextMode="SingleLine"
EnableViewState="True"
Columns="20"
MaxLength="48"
CssClass="iField"
Runat="Server"/>
<asp:RequiredFieldValidator runat="server" ID="EMReq"
ControlToValidate="txtNewEmail"
ValidationGroup="NewUser"
Display="None"
ErrorMessage="<b>Required Field Missing</b><br />Your entry is not a valid e-mail address." />
<ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="EMReqE"
TargetControlID="EMReq"
HighlightCssClass="validatorCalloutHighlight" />
<div class="error-message"></div>
</td>
</tr>
<tr>
<td align="right">* Password:</td>
<td>
<asp:TextBox
ID="txtNewPassword"
TextMode="Password"
EnableViewState="True"
Columns="20"
MaxLength="48"
CssClass="iField"
Runat="Server"/>
<asp:RequiredFieldValidator
ID="PWReq"
ControlToValidate="txtNewPassword"
ValidationGroup="NewUser"
Display="None"
ErrorMessage="<b>Required Field Missing</b><br />A password is required."
Runat="Server"/>
<ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="PWReqE"
TargetControlID="PWReq"
HighlightCssClass="validatorCalloutHighlight" />
<div class="error-message"></div>
</td>
</tr>
<tr>
<td align="right">* Re-type Password:</td>
<td>
<asp:TextBox
ID="txtPasswordConfirm"
TextMode="Password"
EnableViewState="True"
Columns="20"
MaxLength="48"
CssClass="iField"
Runat="Server"/>
<asp:CompareValidator
ID="vldPasswordsMatch"
ControlToValidate="txtPasswordConfirm"
ControlToCompare="txtNewPassword"
Display="Dynamic"
Text="<br/ >The passwords you entered do not match."
Operator="Equal"
Type="String"
Runat="Server"/>
</td>
</tr>
<tr>
<td align="right">Arrival:</td>
<td>
<!--<asp:Image runat="Server" ID="Image3" ImageUrl="images/calendar.png" />-->
<ajaxToolkit:CalendarExtender
ID="CalendarExtender1"
runat="server"
TargetControlID="txtArrive02"
CssClass="wrapCal"
PopupButtonID="Image3" />
<asp:TextBox runat="server" ID="txtArrive02" CssClass="iField" style="width: 80px; border-color: #FFF" />
<asp:DropDownList ID="ddlNights02" runat="server" style="width: 95px">
<asp:ListItem Text="7 Nights" Value="7" />
<asp:ListItem Text="8 Nights" Value="8" />
<asp:ListItem Text="9 Nights" Value="9" />
<asp:ListItem Text="10 Nights" Value="10" />
<asp:ListItem Text="11 Nights" Value="11" />
<asp:ListItem Text="12 Nights" Value="12" />
<asp:ListItem Text="13 Nights" Value="13" />
<asp:ListItem Text="14 Nights" Value="14" />
<asp:ListItem Text="15 Nights" Value="15" />
<asp:ListItem Text="16 Nights" Value="16" />
<asp:ListItem Text="17 Nights" Value="17" />
<asp:ListItem Text="18 Nights" Value="18" />
<asp:ListItem Text="19 Nights" Value="19" />
<asp:ListItem Text="20 Nights" Value="20" />
<asp:ListItem Text="21 Nights" Value="21" />
</asp:DropDownList>
<asp:CustomValidator ID="cvXmas02"
ControlToValidate="txtArrive02" Display="None" runat="server"
ValidationGroup="NewUser"
ErrorMessage="For the Holiday season, there is a 14 day minimum stay"
ClientValidationFunction="XmasCheck02" />
<ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender1"
TargetControlID="cvXmas02" runat="server" />
</td>
</tr>
<tr>
<td> </td>
<td align="center">
<asp:Button
ID="btnCreateAccount"
CssClass="formBut btn btn-load float-left create-account"
Text="Create Account"
CausesValidation="True"
ValidationGroup="NewUser"
Runat="Server" />
<a class="formBut btn btn-load float-left validation-button">Create Account</a>
</td>
</tr>
</table>
</div>
<div id="rightContent" style="z-index:1;">
<h3>Benefits of a Wimco Vacation Account</h3>
<ul style="margin: 0; padding-left: 10px">
<li>See the availability calendar for all 1,500 villas in St Barts, the Caribbean and Europe</li>
<li>Villa search tool that shows you which villas are available on your preferred dates</li>
<li>Villa Suitcase feature – store and compare your favorite villas</li>
</ul>
<h3>Already have an account?</h3>
<p><asp:HyperLink ID="hlMembers" NavigateUrl="login.aspx?ref=mem" runat="server">Members log-in here</asp:HyperLink><br />
<asp:HyperLink ID="HyperLink1" NavigateUrl="login.aspx?ref=email" runat="server">Email a lost password here</asp:HyperLink>
</p> </div>
<asp:Label ID="lblPageState" runat="server" />
</asp:Panel>
<asp:Panel ID="pnlUserCreated" HorizontalAlign="Left" Visible="False" Runat="Server">
<!-- User Account Successfully Created -->
<asp:Label ID="lblRedirect" Runat="Server"/>
<p>If you're seeing this message for more than a few seconds, your browser may have Javascript disabled. <a href="/villas/villasearch.aspx?pnl=c">To continue click here.</a>
</p></asp:Panel>
<asp:Panel ID="pnlUserExists" HorizontalAlign="Left" Visible="False" Runat="Server">
<h1>Setting Up Your Vacation Account</h1>
<!-- User Account Exists with a different password -->
<h4>Email Address Exists</h4>
<p>We found an account using this email address already.
</p> <p><a href="login.aspx">Log in here...</a>
</p></asp:Panel>
<asp:Panel ID="pnlUserNotCreated" Visible="False" Runat="Server">
<h1>Setting Up Your Vacation Account</h1>
<!-- User Account Not Created - Unknown error-->
<h4>Database Error on Login</h4>
<p>There was an error while attempting to log you in. Use the link below to try again. If you keep getting this error message, the service is experiencing a temporary technical problem. Try back in an hour.
</p> <p><a href="login.aspx">Log in here...</a>
</p> <asp:Label ID="lnkAddSuitcase" Visible="False" Runat="server"></asp:Label>
<asp:Label ID="lnkRemSuitcase" Visible="False" Runat="server"></asp:Label>
</asp:Panel>
</asp:content>