【发布时间】:2014-01-29 22:50:04
【问题描述】:
我有以下控制:
@(Html.Kendo().DatePickerFor(model => model.Attributes.DueDate)
.HtmlAttributes(new {
ID = "idSurvey_DueDate",
@data_bind = "value: DueDate",
@Class = "report-label datepicker surveyAttributesData",
TabIndex = 3 })
.Min(DateTime.Now)
)
还有下面的jquery:
$("#idSurvey_DueDate").kendoValidator({
rules: {
dateValidation: function (e) {
var currentDate = kendo.parseDate($(e).val());
// Check if date parse was successful
if (!currentDate) {
return false;
}
return true;
}
},
messages: {
dateValidation: "Invalid Date!",
min: "Date must not be in the past!"
}
});
当我对此进行测试并输入无效日期时,我收到的消息不是我所期望的。相反,它是“字段 DueDate 必须是日期”。这个神秘消息来自哪里,为什么不使用我放入验证器的 messages 属性?我想要的只是不允许无效的日期格式,并且日期不是过去。所以必须执行最低限度。
【问题讨论】:
-
您是否通过 DataAnnotations 或 FluentValidation 使用服务器端验证?
-
据我所知我都没有使用?
标签: validation kendo-ui kendo-asp.net-mvc kendo-datepicker