设置后有什么方法可以删除 submitHandler 或 invalidHandler 吗?如果我提交我的表单并取消我的确认模式窗口,我的其他按钮将继承这些处理程序,而不是做他们应该做的事情。
我尝试在各个地方取消绑定表单提交。以及尝试重新定义后退和保存按钮的验证,但这就像 submitHandler 总是首先被调用
<script type="text/javascript">
$(document).ready(function() {
$(window).keydown(function(event){
document.getElementById('save').src = "/bttn-save.jpg";
});
$.validator.setDefaults({
submitHandler: function() {
tb_show("", "#TB_inline?height=400&width=600&inlineId=confirmblock", null);
}
});
var errorimage = "<img src=\"error.png\" width=\"19\" height=\"19\" alt=\"error\" title=\"error\" style=\"vertical-align:top;margin-top:5px;\" />";
$('#submit').click(function(e) {
$('#promoForm').validate({
submitHandler: function() {
tb_show("", "#TB_inline?height=400&width=600&inlineId=confirmblock", null);
},
invalidHandler: function(e, validator) {
var errors = validator.numberOfInvalids();
if (errors) {
tb_show("", "#TB_inline?height=150&width=250&inlineId=errorblock", null);
}
},
errorElement: "span",
rules: {
additionalinfo: "required"
},
messages: {
additionalinfo: errorimage
}
});
document.getElementById('td_info').innerHTML = document.getElementById('additionalinfo').value;
});
$('#back').click(function() {
$("#promoForm").attr("action", "/step6/?action=back&email=%%=RequestParameter("email")=%%");
});
$('#save').click(function() {
$("#promoForm").attr("action", "/step7/?action=save&email=%%=RequestParameter("email")=%%");
});
$('#confirm').click(function() {
document.getElementById('promoForm').action = "http://pages.email.microsoftemail.com/thatsit/?email=%%=RequestParameter("email")=%%"
document.getElementById('promoForm').submit();
});
$('#attach').click(function() {
tb_show("", "#TB_inline?height=300&width=336&inlineId=uploadblock", null);
});
});
</script>