好的,我正在使用umbraco论坛模块,在评论表单上它使用jquery验证插件。
我做了一些研究,并添加了'取消'css类的按钮。这绕过了第一个验证问题,但是,它仍然属于“submitHandler”。阅读源代码并找到一种方法来检测搜索按钮是否触发提交。但是,没有一个好方法可以绕过处理程序。
顺便说一句,我目前正在使用:
submitHandler: function (form) {
$(form).find(':hidden').each(function () {
var name = $(this).attr('name');
if (name && name.indexOf('btnSearch') === name.length - 'btnSearch'.length) {
// this is a dirty hack to avoid the validate plugin to work for the button
eval("var error = 1 2 ''");
}
});
// original code from umbraco ignored here....
}
jQuery Validation plugin: disable validation for specified submit buttons
(这是有点不同,因为submitHandler是在这一个使用…)