最佳答案
我可以使用 鞋带轻松地显示弹出窗口,我也可以使用标准的 JQuery 验证插件或 JQuery 验证引擎进行验证,但是我不知道如何将其中一个插入到另一个中。
我想我需要的是一些钩子,当验证程序想要显示一个通知时,它会调用这些钩子,给它一个闭包,将消息和目标元素传递给 popover。这看起来像是一种依赖注入。
理论上都不错,但我就是想不出钩子在哪里,或者哪个验证引擎中是否存在钩子。他们似乎都愿意承担起显示通知的责任,提供各种复杂的布局、包装、样式选项,而我所追求的只是错误类型(我甚至不一定需要消息文本)和与之相关的元素。我找到了整个表单的钩子,而不是单独的通知。
我更喜欢使用类来定义规则的验证系统,因为它们可以很好地处理动态创建的表单。
有人有解决办法或者更好的主意吗?