简体   繁体   English

MVC ClientSide日期验证

[英]MVC ClientSide date validation

I'm using xVal and jQuery for clientside form validation in MVC. 我使用xVal和jQuery在MVC中进行客户端表单验证。

A date field annotated with [DataType(DataType.Date, ErrorMessage=...)] is being properly validated if the user types a string that does not fit into the designated format. 如果用户键入的字符串不符合指定的格式,则使用[DataType(DataType.Date,ErrorMessage = ...)]注释的日期字段将得到正确验证。 But if the user types something with invalid month or day, eg, 13/32/2010, it is not validate until submission to the server. 但是,如果用户键入的日期或日期无效(例如13/32/2010),则只有在提交到服务器后才能进行验证。

Does anyone know of any quick way to more robustly validate dates on the client side? 有谁知道在客户端更有效地验证日期的快捷方法吗?

You are using xVal and looking for client side validation? 您正在使用xVal并在寻找客户端验证吗? Always check newest release changes. 始终检查最新的发行版更改。 Similar post 类似帖子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM