javascript - Asp 自定义验证器在 IE-11 中不起作用

标签 javascript internet-explorer-11 asp.net-2.0

我正在使用兼容性边缘模式将应用程序从 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 问题 <meta>在页面标题部分添加与 IE-11 兼容的标签效果很好。

关于javascript - Asp 自定义验证器在 IE-11 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37190222/

相关文章:

c# - C# 中的对象初始值设定项导致编译时错误

asp.net - ASP.NET 中的默认 session 超时是多少?

javascript 输入字段或数组表现异常

javascript - 如何设置js函数滚动让它不超过父级的底部?

css - Flex 自动边距在 IE10/11 中不起作用

javascript - CSS - 使用 Jquery 动态计算 IE11 的宽度

c# - 手动增加新行的 PK 时如何避免数据库竞争条件

javascript - 实例化我的扩展 Ext JS FormPanel 实例时发生 TypeError

javascript - 带有和参数范围长度属性

internet-explorer - 为什么即使在模拟 Internet Explorer 8 文档模式时,Internet Explorer 11 也不支持条件注释?