0

how to stop page refresh on form submit in jQuery-Validation-Engine I'm using 4 tabs with each has different form, but on submit it should stay in same tab...

$('#AddPartnerSubmitBtn').live('click', function () { 
  var formvalidate; 
  formvalidate=$("#AddPartner").validationEngine("validate"); 
   if(formvalidate==1) { } 
 });
8
  • Without knowing you code it is hard to guess. But most likely you need to prevent de default behavior of the submit event. Commented Jul 1, 2013 at 15:08
  • Submit your code along with your question. Commented Jul 1, 2013 at 15:08
  • make a fiddle || add some code with your tests plz Commented Jul 1, 2013 at 15:08
  • Use $.ajax to submit your form. Commented Jul 1, 2013 at 15:10
  • use event.PreventDefault Commented Jul 1, 2013 at 15:13

1 Answer 1

3

Use event.preventDefault

$('#AddPartnerSubmitBtn').live('click', function (event) { 

  // this will prevent the form from submitting 
  event.preventDefault();

  var formvalidate; 
  formvalidate=$("#AddPartner").validationEngine("validate"); 
  if(formvalidate==1) { } 
 });
Sign up to request clarification or add additional context in comments.

1 Comment

I think it would be wise to use the on-submit on the form instead of an on-click handler on the button. If the form is submitted in an other way, it is not guaranteed that this event will fire.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.