I have 4 buttons in a form. Save, Back, Submit, Confirm. The submit does form validation and has a submitHandler and invalidHandler. If no errors, a modal Confirm screen is shown with another button of Confirm. This button does the actual post to the form to complete the process.
The Save and Back buttons need to post the form, but does not have any validation. The problem is that if I hit Submit and my Confirm modal pops up and I cancel out the Save and Cancel button now inherit the submitHandler and invalidHandler of the Submit button. So if i click on save of back, the Confirm modal pops up. Ideally, I would like to remove the Handler's if the Save or Back button are clicked. I've tried unbinding the form and submitting it myself, but the Modal window still pops up. I have a working example I can give out individually if required. Here is my JS: [code] <script type="text/javascript"> $(document).ready(function() { $(window).keydown(function(event){ document.getElementById('save').src = "/bttn- save.jpg"; }); 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 = "/ thatsit/?email=%%=RequestParameter("email")=%%" document.getElementById('promoForm').submit(); }); $('#attach').click(function() { tb_show("", "#TB_inline? height=300&width=336&inlineId=uploadblock", null); }); }); </script> [/code]