必需的字段validation器不适用于JQuery选择的下拉列表

我正在使用JQuery Choosen为我的DropDownList,但该下拉列表所需的validation器不起作用。 以下是我的代码。请指导我错了。

选择插件包含在表单中

$(".chosen-select").chosen(); 

DropDownList代码

 
  • @Html.LabelFor(m => m.DepartmentId) @Html.DropDownListFor(x => x.DepartmentId, (ViewBag.DepartmentsList) as IEnumerable, "-- Select an Option --",new { @class = "chosen-select", @style = "width:312px; height:31px;" }) @Html.ValidationMessageFor(m => m.DepartmentId)
  • 和DropDownList的模型

     [Required(ErrorMessage = "*")] [Display(Name = "Department Name")] public int DepartmentId { get; set; } 

    jQuery Chosen通过使原始选择隐藏来更新html(style =“Display:none”)。 默认情况下,jquery.validate(1.9.0)忽略隐藏的元素。 您可以使用覆盖默认值

     $.validator.setDefaults({ ignore: [] });