ASP.NET验证的远程只模糊? [英] ASP.NET Remote Validation only on blur?

查看:80
本文介绍了ASP.NET验证的远程只模糊?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用MVC中3远程验证,但似乎火,我输入一些东西任何时候,如果它是场一直活跃的第二次。问题是,我有一个自动完成框,所以他们可能对结果点击来填充字段,MVC意见,留下吧。

I'm using the remote validation in MVC 3, but it seems to fire any time that I type something, if it's the second time that field's been active. The problem is that I have an autocomplete box, so they might click on a result to populate the field, which MVC views as "leaving" it.

即使从autcomplete身外之物,我不希望它尝试验证时,他们通过写作是半途而废。有没有一种方法,我可以说只运行验证n毫秒他们完成后,输入或只有模糊的运行验证?

Even apart from the autcomplete thing, I don't want it to attempt to validate when they're halfway through writing. Is there a way that I can say "only run validation n milliseconds after they are finished typing" or "only run validation on blur?"

推荐答案

MVC 3依赖于jQuery验证插件客户端验证。您需要配置该插件不关键了验证。

MVC 3 relies on the jQuery Validation plugin for client side validation. You need to configure the plugin to not validate on key up.

您可以在全球关闭它使用

You can switch it globally off using

$.validator.setDefaults({
   onkeyup: false
})

请参阅http://docs.jquery.com/Plugins/Validation/Validator/setDefaults而这里的onkeyup选项<一个href=\"http://docs.jquery.com/Plugins/Validation/validate\">http://docs.jquery.com/Plugins/Validation/validate.

See http://docs.jquery.com/Plugins/Validation/Validator/setDefaults and the onkeyup option here http://docs.jquery.com/Plugins/Validation/validate.

这篇关于ASP.NET验证的远程只模糊?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆