I can make popovers appear using bootstrap easily enough, and I can also do validations using the standard jQuery validation plugin or the jQuery validation engine, but I can't figure out how to feed one into the other.
I think what I need is some hook which is called by the validator when it wants to display a notification, give it a closure that passes the message and the target element to a popover. This seems like a kind of dependency injection.
理论上一切都很好,但是我就是不知道那个钩子在哪里,或者即使在任何一个验证引擎中都存在一个钩子.当我想要的只是错误类型(我甚至不一定需要消息文本)和与之相关的元素时,它们似乎都致力于用各种精心设计的放置、包装、样式选项来显示通知.我找到了整个表单的挂钩,而不是单个通知.
我更喜欢使用类来定义规则的验证系统,因为它们可以很好地处理动态创建的表单.
Anyone have a solution or a better idea?