验证pfilled jQuery的形式$ P $(在第一场无效清晰,ASP.NET和unobtrustive) [英] Validate prefilled jQuery form (invalidate on first field clear, ASP.NET and unobtrustive)

查看:227
本文介绍了验证pfilled jQuery的形式$ P $(在第一场无效清晰,ASP.NET和unobtrustive)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以可以填写,保存,载入和重新编辑的形式。

I have a form that can be filled, saved, loaded and re-edited.

当它被加载和重新编辑,它可能开始其寿命有效。 当一个领域是在负载有效,我要当编辑违背规则,它立即失效。这是我简单地说的问题,我怀疑这是由一些配置选项的支持我不能找到的。

When it is loaded and re-edited, it probably begins its life valid. When a field is valid upon load, I want it to invalidate immediately when it is edited contrary to rules. That's my question in a nutshell, and I suspect this is supported by some configuration option I can't find.

结果

目前,它工作正常后,才(上述期望的方式):1)它是编辑,2),那么字段失去焦点而有效的,3)然后再编辑它。因此,需要重点额外损失的有效可视化误差为pre-填好的表格。

Currently, it works properly (the way desired above) only after: 1) it is edited, 2) then the field loses focus while valid, 3) then is edited it again. So it takes an extra valid loss of focus to visualize errors for a pre-filled form.

如果它是在负载空(如第一次访问)它不应该显示错误

If it is empty on load (such as the first visit) it should not show errors.

我用下面已经在我的框架:

I'm using the following already in my framework:


  • jQuery.validate(以下简称批准的一个,我的问题的重点)

  • 对于ASP.NET MVC 3不显眼的jQuery验证适配器

我目前没有运行任何自定义的code 可激活此功能,因为不显眼适配器初始化验证(但我很高兴,要解决这个问题)。我试着加入'form.valid()在页面加载,但它不能解决以上,事实上打破了更多的东西。

I don't currently run any custom code to activate this, since the 'unobtrusive' adapter initializes validation (but I'd be happy to, to fix this). I've tried adding 'form.valid()' on page load, but it doesn't fix the above and in fact breaks more stuff.

谢谢,
香农

推荐答案

我已经挖成的验证插件,开了票,我相信这是一个缺陷。

I've dug into the validation plug-in, and opened a ticket for what I believe is a defect.

https://github.com/jzaefferer/jquery-validation/issues/146

这篇关于验证pfilled jQuery的形式$ P $(在第一场无效清晰,ASP.NET和unobtrustive)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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