Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5968439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:05:25+00:00 2026-05-22T20:05:25+00:00

I have a form which upload a big file to server. Something like this:

  • 0

I have a form which upload a big file to server. Something like this:

<form id="myform" action="myaction.php">
  <p>
    <!--fields -->
  </p>
  <input type="submit" class="submit" value="Send" />
</form>

I need to prevent the user resubmit the form while the previous processing is not ready. How can I disable submit button before processing and enable the button after submit action?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:05:25+00:00Added an answer on May 22, 2026 at 8:05 pm

    The correct way to do this in jQuery, as of version 1.6, is with the new prop() method.

    Also important is that you attach the event to the form’s submit event, NOT to the submit button itself. That way if someone hits enter while filling out the form, like I’m sure we all do, the button will still be disabled.

    Correct code:

    $("#myform").submit(function() {
        $("#myform .submit").prop('disabled', true);
    }
    

    If you really want to block access to the form being submitted multiple times, you would stop the form from being submitted too, not just disable the button:

    var myform = $("#myform");
    myform.submit(function() {
        if($.data(myform.get(0), 'submitting') {
            return false;
        }
    
        $.data(myform.get(0), 'submitting', true);
        $(".submit", myform).prop('disabled', true);
    });
    

    All other solutions are WRONG! 🙂

    Just kidding, they’ll work too, but this will catch more exceptional logic and handles the property correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

regarding file uploads, I have a form through which I upload a file, I
I have File Upload form which users use to upload certain files on the
I have a form which uploads multiple file fields into a db using codeigniter.
I have a C# form into which I've placed a left-docked MenuStrip . This
I have been trying to use an ajax-style file upload component (like the dojox
I have form with file upload. The files to be uploaded actually are pictures
I have a form which is used to insert/display and update . In the
I have a form which takes both the user details and an image uploaded
I have a form which has a lot of SELECTs. For various reasons, I'd
In my Rails app, I have a form which redirects through a foreign service,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.