清除淘汰赛验证错误 [英] Clear error on Knockout-Validation

查看:59
本文介绍了清除淘汰赛验证错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Knockout.js并使用Knockout-Validation进行页面设置.

I have a page setup with Knockout.js and using Knockout-Validation.

在页面加载期间,我在选择框上放置了另一个插件,该插件触发了更改,从而触发了验证.我需要能够使用JS清除该错误,以便我可以从全新的UI入手,并提供有关表单发布或选择框更改的反馈.

During the page load I put another plugin on a select box which fires a change, which fires the validation. I need to be able to clear that error using JS so I can start with a fresh looking UI and give feedback on the form post or select box change.

我找不到任何东西可以清除Knockout-Validation中的错误.

I can't find anything that allows me to clear an error in Knockout-Validation.

推荐答案

在剔除验证中已经实现的更好的方法可能是说property.isModified(false);

Probably a better way that follows what is already implemented in knockout validation is to say property.isModified(false);

如果您要重置整个视图模型,则只需遍历所有已验证的属性并调用isModified(false)

if you have a whole view model to reset simply loop through all the validated properties and call that isModified(false)

请参阅此处的来自Eric Barnard的评论

希望有帮助

这篇关于清除淘汰赛验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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