Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm using jQuery Validation Engine (https://github.com/posabsolute/jQuery-Validation-Engine) to validate my form. I want to disable submit button to prevent multiple submits if validation is true. I couldn't achieve this with callback functions.

share|improve this question
    
Show what you have so far. –  amit_g Jan 16 '12 at 22:56

2 Answers 2

I always do this trick

$('#yourform').submit(function() {
    if($(this).hasClass('blockSubmit')) return false;
    $(this).addClass('blockSubmit');
    /*
     * organizing data, requesting, responding, et cetra cetra...
     */
    $(this).removeClass('blockSubmit');
});
share|improve this answer

I typically do this:

$('#theform').submit(function() {
    $('#submitbutton').attr('disabled', 'disabled');
});

Of course if you are doing any onsubmit validation that fails you have to reenable the button:

$('#submitbutton').removeAttr('disabled');
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.