动态客户端验证
有人在做动态客户端验证吗?如果是的话,你是怎么做的?
我有一个通过 jquery 验证器启用客户端验证的视图(见下文),
<script src="../../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcJQueryValidation.js" type="text/javascript"></script>
<% Html.EnableClientValidation(); %>
这会导致我的页面上生成 javascript 代码,当我单击提交按钮时,该代码会调用验证:
function __MVC_EnableClientValidation(validationContext) {
....
theForm.validate(options);
}
如果我希望在 onblur 事件发生在文本框我怎样才能让它工作?
Is anyone doing dynamic client validation and if so how are you doing it.
I have a view where client side validation is enabled through jquery validator ( see below)
<script src="../../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcJQueryValidation.js" type="text/javascript"></script>
<% Html.EnableClientValidation(); %>
This results in javascript code been generated on my page which calls validate when I click the submit button:
function __MVC_EnableClientValidation(validationContext) {
....
theForm.validate(options);
}
If I want validation to occur when the onblur event occurs on a textbox how can i get this to work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
就我个人而言,我喜欢 ASP.NET MVC 验证,但是 jquery 也可以工作,
或者如果你想真正把它锤炼回家,
理论上这些应该工作......无论如何,一旦用户单击提交,然后 onblur 开始验证,这似乎就足够了对于jquery人来说。
Personally I like the ASP.NET MVC Validation but the jquery one can work too
or if you want to really hammer it home
Those should in theory work ... at any rate once the user clicks submit then onblur starts validating which seems to be enough for the jquery people.