1

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.

0

2 Answers 2

1

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');
});
Sign up to request clarification or add additional context in comments.

Comments

0

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');

Comments

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.