私は以下のページを持っていますが、IEとChromeでは完全に動作しますが、FFでは動作しません。 FFでは、検証が表示される唯一のフィールドは名字です。そして、すべてが正しく記入されていれば、提出ボタンは何もしません。.NETフィールドバリデーターがFF10で壊れています
<script type="text/jscript">
function CheckControls(sender, args) {
var tCell = document.getElementById('<%=tbxCell.ClientID%>');
var dCell = document.getElementById('<%=ddlCarrier.ClientID%>');
if (tCell.value.length == 0) {
args.IsValid = true;
return;
}
if (dCell.options[dCell.selectedIndex].value == 0) {
args.IsValid = false;
return;
}
args.IsValid = true;
return;
}
function CheckControls2(sender, args) {
var tCell = document.getElementById('<%=tbxCell.ClientID%>');
var dCell = document.getElementById('<%=ddlContactType.ClientID%>');
if (dCell.options[dCell.selectedIndex].value <= 1) {
args.IsValid = true;
return;
}
if (tCell.value.length == 0) {
args.IsValid = false;
return;
}
args.IsValid = true;
return;
}
</script>
<div style="padding:20px 0px 0px 75px">
<div style="float:left">
*First Name: <br />
<asp:TextBox runat="server" ID="tbxFirst" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Display="Dynamic" ControlToValidate="tbxFirst" Text="<br />*Required Field" /><br />
*Last Name: <br />
<asp:TextBox runat="server" ID="tbxLast" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Display="Dynamic" ControlToValidate="tbxLast"
Text="<br />*Required Field" /><br />
Cell: <br />
<asp:TextBox runat="server" ID="tbxCell" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="tbxCell" Display="Dynamic" ErrorMessage="<br />*Blank or 10 Digits No Spaces" ValidationExpression="^$|^\d{10}$"
runat="server" /><br />
<asp:Label ID="lblCellTaken" CssClass="errorCol" runat="server" Visible="false">This cell number is already in use.<br /></asp:Label>
Cell Carrier: <br />
<asp:DropDownList id="ddlCarrier" runat="server" AppendDataBoundItems="True"
DataSourceID="CarrierDataSource" DataTextField="CarrierName" DataValueField="ID">
<asp:ListItem Selected="True" Text="Select One" Value="0" />
</asp:DropDownList>
<asp:CustomValidator runat="server" Display="Dynamic" ClientValidationFunction="CheckControls" ControlToValidate="ddlCarrier"
ErrorMessage="<br />*Cell Number Requires Carrier" ID="cvCarrier" /><br />
Contact Method: <br />
<asp:DropDownList id="ddlContactType" runat="server" AppendDataBoundItems="True"
DataSourceID="ContactTypeDataSource" DataTextField="ContactTypeName" DataValueField="ID">
<asp:ListItem Selected="True" Text="Select One" Value="-1" />
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" Display="Dynamic" ControlToValidate="ddlContactType"
Text="<br />*Required Field" InitialValue="-1" />
<asp:CustomValidator runat="server" Display="Dynamic" ClientValidationFunction="CheckControls2" ControlToValidate="ddlContactType"
ErrorMessage="<br />*Text requires cell number" ID="cvContact" /><br />
<asp:UpdatePanel runat="server" ID="upTimes" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="pnlTimes" runat="server">
All Times Eastern<br />
Notification Start Time:<br />
<asp:DropDownList ID="ddlStartHours" runat="server">
<asp:ListItem Text="12" Value="0" />
<asp:ListItem Text="1" />
<asp:ListItem Text="2" />
<asp:ListItem Text="3" />
<asp:ListItem Text="4" />
<asp:ListItem Text="5" />
<asp:ListItem Text="6" />
<asp:ListItem Text="7" />
<asp:ListItem Text="8" />
<asp:ListItem Text="9" />
<asp:ListItem Text="10" />
<asp:ListItem Text="11" />
</asp:DropDownList>
:<asp:DropDownList ID="ddlStartMinutes" runat="server">
<asp:ListItem Text="00" />
<asp:ListItem Text="15" />
<asp:ListItem Text="30" />
<asp:ListItem Text="45" />
</asp:DropDownList>
<asp:DropDownList ID="ddlStartAMPM" runat="server">
<asp:ListItem Text="AM" />
<asp:ListItem Text="PM" />
</asp:DropDownList><br />
Notification Stop Time:<br />
<asp:DropDownList ID="ddlStopHours" runat="server">
<asp:ListItem Text="12" Value="0" />
<asp:ListItem Text="1" />
<asp:ListItem Text="2" />
<asp:ListItem Text="3" />
<asp:ListItem Text="4" />
<asp:ListItem Text="5" />
<asp:ListItem Text="6" />
<asp:ListItem Text="7" />
<asp:ListItem Text="8" />
<asp:ListItem Text="9" />
<asp:ListItem Text="10" />
<asp:ListItem Text="11" Selected="True" />
</asp:DropDownList>
:<asp:DropDownList ID="ddlStopMinutes" runat="server">
<asp:ListItem Text="00" />
<asp:ListItem Text="15" />
<asp:ListItem Text="30" />
<asp:ListItem Text="45" Selected="True" />
</asp:DropDownList>
<asp:DropDownList ID="ddlStopAMPM" runat="server">
<asp:ListItem Text="AM" />
<asp:ListItem Text="PM" Selected="true" />
</asp:DropDownList><br />
</asp:Panel>
No Start/Stop Time:<br />
<asp:CheckBox ID="cbxNoTime" runat="server" AutoPostBack="true"
oncheckedchanged="cbxNoTime_CheckedChanged" /><br />
</ContentTemplate>
</asp:UpdatePanel>
*Maximum Simultanious<br />Notifications:<br />
<asp:DropDownList runat="server" ID="ddlNumNotifications" >
<asp:ListItem Value="-1">Pick One</asp:ListItem>
<asp:ListItem Value="0">Unlimited</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="6">6</asp:ListItem>
<asp:ListItem Value="7">7</asp:ListItem>
<asp:ListItem Value="8">8</asp:ListItem>
<asp:ListItem Value="9">9</asp:ListItem>
<asp:ListItem Value="10">10</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" Display="Dynamic" ControlToValidate="ddlNumNotifications"
Text="<br />*Required Field" InitialValue="-1" /><br />
</div>
<div style="width:50px;float:left"> </div>
<div style="float:left ">
*Email: <br />
<asp:TextBox runat="server" ID="tbxEmail" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" Display="Dynamic" ControlToValidate="tbxEmail"
Text="<br />*Required Field" />
<asp:RegularExpressionValidator ID="regexEmailValid" runat="server" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
ControlToValidate="tbxEmail" ErrorMessage="<br />*Invalid Email Format" Display="Dynamic" />
<asp:Label ID="lblEmailInUse" CssClass="errorCol" runat="server" Visible="false"><br />This email is already in use.</asp:Label>
<br />
*Confirm Email: <br />
<asp:TextBox runat="server" ID="tbxConfirmEmail" /><br />
<asp:CompareValidator runat="server" Enabled="true" ErrorMessage="*Emails Don't Match<br />" ControlToValidate="tbxConfirmEmail"
ControlToCompare="tbxEmail" ID="cvEmails" CultureInvariantValues="true" Display="Dynamic" />
<asp:RequiredFieldValidator ID="rfvConfirmEmail" runat="server" Display="Dynamic" ControlToValidate="tbxConfirmEmail"
Text="*Required Field<br />" Enabled="false" />
Password: <br />
<asp:TextBox runat="server" ID="tbxNew" TextMode="Password" MaxLength="20" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="<br />*Required Field"
ControlToValidate="tbxNew" Display="Dynamic" />
<asp:PasswordStrength ID="PasswordStrength1" runat="server" TargetControlID="tbxNew"
MinimumLowerCaseCharacters="1" MinimumNumericCharacters="1" MinimumUpperCaseCharacters="1"
PreferredPasswordLength="8" StrengthIndicatorType="Text" RequiresUpperAndLowerCaseCharacters="true"
DisplayPosition="RightSide" HelpStatusLabelID="lblPassHelper" TextStrengthDescriptions="Weak;Average;Strong;Excellent"
TextStrengthDescriptionStyles="strenWeak;strenAverage;strenStrong;strenExcellent" /> <br />
<asp:TextBox ID="lblPassHelper" TabIndex="-1" ReadOnly="true" TextMode="MultiLine" CssClass="invisibleBox" runat="server" /><br />
Confirm Password: <br />
<asp:TextBox runat="server" ID="tbxConfirm" TextMode="Password" MaxLength="20" />
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="tbxConfirm" ControlToValidate="tbxNew"
Operator="Equal" Text="<br />*Passwords Must Match" /><br />
<asp:LinkButton Text="Create Account" ID="lbCreateAccount" runat="server"
CssClass="darkLink" CausesValidation="true"
onclick="lbSubmitUser_Click" /><br />
<asp:Label id="lblUpdatePassStatus" runat="server" />
</div>
</div>
<asp:LinqDataSource ID="CarrierDataSource" runat="server"
ContextTypeName="DataLayer.FantasyDataContext"
Select="new (ID, CarrierName)" TableName="CellCarriers">
</asp:LinqDataSource>
<asp:LinqDataSource ID="ContactTypeDataSource" runat="server"
ContextTypeName="DataLayer.FantasyDataContext"
Select="new (ID, ContactTypeName)" TableName="ContactTypes">
</asp:LinqDataSource>
<script type="text/javascript">
ValidatorHookupControlID('<%= tbxCell.ClientID %>',
document.getElementById('<%= cvCarrier.ClientID %>'));
ValidatorHookupControlID('<%= tbxCell.ClientID %>',
document.getElementById('<%= cvContact.ClientID %>'));
</script>
は、JavaScriptコンソール(またはFirebugの)中にすべてのエラーを参照していますか? – Pointy
ああ、私はこれを参照してください:CheckControlsは定義されていません しかし、私はそれをトップに宣言しました、私の宣言に何か間違っていますか? –
スクリプトの種類はjscriptではなくjavascriptである必要があります。ありがとう! –