-->

jQuery的 - 验证剑道下拉列表以显示:无风格(jQuery - validate kendo

2019-10-19 14:31发布

在我看来,我有一个下拉列表剑道。 从来就实现jQuery验证将在考虑到这些脚本:

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

我给自己定的属性作为实体必需的和所有我需要进行验证。

模型:

[Required(ErrorMessage = "Campo Tipo de Llenado es necesario")]
        public int TipoLlenado { get; set; }

视图:

@(Html.Kendo()
    .DropDownListFor(model => model.pedidoGranelAutoEs.TipoLlenado)
    .BindTo(new SelectList(cmbTipoLlenado.Select(s => new { Key = s.IdDatoMaestro, Value = s.ValorPortal }), "Key", "Value"))
    .Events(events =>
    {
        events.Select("selectTipoLlenado");                         
    })
    .OptionLabel(Idioma.Shared.Pedidos_SeleccioneOpcion)
    )
@Html.ValidationMessageFor(model => model.pedidoGranelAutoEs.TipoLlenado)

问题是,如果我检查与Chrome的网页,并删除了“显示:无”从(使用剃刀)剑道DropDownList中产生的输入风格,然后按提交按钮确认工作正常。

我试过没有结果如下解决方案:

$(document).ready(function () {
        $('#formu').validate({
            ignore: []
        });
}

要么

$(document).ready(function () {
        $('#formu').validate({
            ignore: ':hidden'
        });
}

要么

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

要么

$.validator.setDefaults({ ignore: ':hidden' });

任何建议?

提前致谢!!

Answer 1:

我发现了错误。 这是我写的一行:

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

外面$(document).ready(function () {...}



文章来源: jQuery - validate kendo dropdownlist with display:none style