如何使用 jQuery 验证来验证 Kendo 下拉列表

How to validate Kendo Dropdownlist using jQuery validate

我的表单中有普通剃须刀和 kendo 控件,我在尝试使用 jquery 验证插件验证 kendo 下拉列表时遇到了一些问题。 下面是我的代码。

 @(Html.Kendo().DropDownList()
          .Name("color")
          .DataTextField("Text")
          .DataValueField("Value")
          .BindTo(new List<SelectListItem>() {
             new SelectListItem() {
                  Text = "Select Value",
                  Value = ""
              }, new SelectListItem() {
                  Text = "Black",
                  Value = "2"
              },
              new SelectListItem() {
                  Text = "Orange",
                  Value = "3"
              },
              new SelectListItem() {
                  Text = "Grey",
                  Value = "4"
              }
          }).Value("")
          .HtmlAttributes(new { style = "width: 100%" })
    )
    <input type="submit" value="Submit" />

现在我已经使用了我的 jquery 验证方式

$(document).ready(function () {
        $("#dropDownForm").validate({
            rules: {
                color: "required"
            },
            highlight: function (element) {
                alert('highlight');
            },
            unhighlight: function (element) {
                alert('unhighlight');
            },
            errorPlacement: function (error, element) {
                return false;
            },
            debug: true
        });
    });

但我无法验证下拉列表,并且 jquery 验证插件的突出显示和取消突出显示事件都没有被调用。 任何帮助表示赞赏。 谢谢

推荐如下

Put $.validator.setDefaults({ ignore: '' }); not inside $(document).ready

jQuery Validate - Enable validation for hidden fields

http://www.telerik.com/forums/mvc-client-validation-not-working