在jquery.validate中添加错误/删除错误

时间:2022-12-04 13:56:45

I'm trying to implement a generic way of adding remote validation to xVal / jquery.validate

我正在尝试实现一种向xVal / jquery.validate添加远程验证的通用方法

There are only two unsolved questions left:

只剩下两个未解决的问题:

  • How do I "manually" mark a form element as invalid and add an error message to it from my own javascript code?

    如何“手动”将表单元素标记为无效,并从我自己的javascript代码向其添加错误消息?

  • How do I remove remove the error message at a later time without removing any other error messages?

    如何删除以后删除错误消息而不删除任何其他错误消息?

Is there any neat way to do this or do I have to hack a solution that takes into account how jquery.validate works internally?

有没有任何巧妙的方法来做到这一点,还是我必须破解一个考虑到jquery.validate内部如何工作的解决方案?

1 个解决方案

#1


I've found a much better way to solve this and wrote a blog article on how to implement remote client-side validation in a generic way in case someone else is also interested in remote client-side validation.

我找到了一个更好的方法来解决这个问题,并写了一篇关于如何以通用方式实现远程客户端验证的博客文章,以防其他人也对远程客户端验证感兴趣。

#1


I've found a much better way to solve this and wrote a blog article on how to implement remote client-side validation in a generic way in case someone else is also interested in remote client-side validation.

我找到了一个更好的方法来解决这个问题,并写了一篇关于如何以通用方式实现远程客户端验证的博客文章,以防其他人也对远程客户端验证感兴趣。