必需属性的数据注释在IE8中不起作用

时间:2014-04-07 07:24:29

标签: asp.net-mvc

我有JCery版本1.9.1的MVC - 4项目和Jquery UI - 1.10.2。 我使用下面的代码

[Required(ErrorMessage = "Required")]
public string Name { get; set; }

哪个浏览器适用于所有其他浏览器,然后IE-8。 你可以告诉我在IE-8中我需要做些什么。

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

这是jquery.validate.js版本。

检查以下建议:

MV3 input validation - IE8 & IE9 behave differently

有问题的是jquery.validate.js。获取最新版本或更改

return $([]).add(this.currentForm.elements)             
.filter(":input")

return $(':input', this.currentForm)

工作代码:

//return $([]).add(this.currentForm.elements)             
//.filter(":input")             
return $(':input', this.currentForm)             
.not(":submit, :reset, :image, [disabled]")             
.not( this.settings.ignore )             
.filter(function() {
    !this.name && validator.settings.debug && window.console && console.error( "%o has no name assigned", this);                              
    // select only the first element for each name, and only those with rules specified                 
    if ( this.name in rulesCache || !validator.objectLength($(this).rules()) )
        return false;                                  
    rulesCache[this.name] = true;                 
    return true;             
});

Refrence:

http://www.sitepoint.com/forums/showthread.php?848476-MVC3-Razor-Client-Validation-Problem-in-IE-8-and-Bind-Exclude-Problem