[英]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? 有谁知道在客户端更有效地验证日期的快捷方法吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.