[英]Asp custom validator is not working in IE-11
我正在使用兼容性邊緣模式將我的應用程序從IE 9遷移到IE 11。 asp自定義驗證程序和必需字段驗證程序在IE 11中不起作用,但page.isValid()始終返回true。 但它在IE 9中運行良好。
示例代碼:
<asp:DropDownList ID="cboType" onChange="fnInvalid(this,'hidTypeValid');getSelectedValue('cboType','hidliab');changeOptions(document.forms[0].hidliab,document.forms[0].cmbLiability,document.forms[0].hid_liab,document.forms[0].HIDSERLIAB);" runat="server" name="cbotype"AutoPostBack="true"></asp:DropDownList>
<asp:RequiredFieldValidator ID="VreqvalidateType" runat="server" Display="None" ControlToValidate="cboType" ErrorMessage="-Case Type should not be blank" InitialValue="Choose"></asp:RequiredFieldValidator>
<asp:CustomValidator ClientValidationFunction="fnInvalidSelection" ID="VcustTypeValid"
runat="server" Display="None" ControlToValidate="cboType" ErrorMessage="-Case Type should have valid selection."></asp:CustomValidator>
<asp:CustomValidator ClientValidationFunction="fnTypeFileClass" ID="VcusTypeFile" runat="server" Display="None" ControlToValidate="cboType" ErrorMessage="- Case File Classification should not be empty."></asp:CustomValidator>
<asp:CustomValidator Enabled="false"ClientValidationFunction="fnTypeCaseHandler"ID="VcusTypeCaseHandler" runat="server" Display="None" ControlToValidate="cboType"ErrorMessage="- Case Handler 1 should not be empty."></asp:CustomValidator>
使用Javascript:
<pre lang="C#">function fnTypeCaseHandler(sender,args)
{
var s = args.Value;
args.IsValid = true;
if (s!="K")
{
var handler1= document.frmCaseDetails.cmbHandler1.value;
if (handler1 =="Choose")
{
args.IsValid = false;
}
}
return args.IsValid;
}
function fnTypeFileClass(sender,args)
{
var s = args.Value;
args.IsValid = true;
if (s!="K")
{
var file = document.frmCaseDetails.cmbFileClass.value;
if (file =="Choose")
{
args.IsValid = false;
}
}
return args.IsValid;
}
這是因為IE-11問題我們已經在頁面的標題部分中使IE-11兼容性的<meta>
標簽運行良好。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.