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 985015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:06:12+00:00 2026-05-16T05:06:12+00:00

The full story is I want to disable the submit button on a form’s

  • 0

The full story is I want to disable the submit button on a form’s submission to prevent multiple submissions. One of the problems is the form is an ASP.Net MVC Ajax form – <% using (Ajax.BeginForm … %> – so its javascript onSubmit event is already set and I therefore cannot do this during that event. Unless there’s a way to add to the submit event with jQuery? My testing shows that $(“#form”).submit(…) replaces the submit event and thusly kills MVC’s ajaxy stuff.

So what I’ve done is attached the button-disabling code to the submit button’s click event. That works fine … only it kills the button’s submission abilities (nothing happens other than the button gets disabled). I took it a step further and used jQuery to submit the form from the click event. This borks everything, the ajax response comes back as a downloaded file, I assume because MVC’s ajax stuff got clobbered again. This is where I’m at:

$("#submitButton").click(function ()
{
    var $button = $(this);
    $button.parent().submit();
    $button.attr("disabled", "disabled");
});

Any one know a work-around?

Edit:
So, turns out this actually may be a bug in MVC. Originally I had:

<% using (Ajax.BeginForm("CreateAsync", "Account", new AjaxOptions
    {
        HttpMethod = "POST",
        OnComplete = "create_Complete",
        OnBegin = "create_Begin"
    },
    new { id = "ajaxForm" }))
{ %>
<!-- form stuff -->
<% } %>

$("#ajaxForm").submit(function() {
    $(":submit", this).attr("disabled", "disabled");
});

Notice I was setting the form’s ID and grabbing a jQuery handle to it via that ID. Looks like the simple fact that I’m setting the ID of the form is causing all the issues. In fact, I can break the form submission w/o any jQuery intervention what-so-ever if I set the form ID. So this works totally as advertised:

<% using (Ajax.BeginForm("CreateAsync", "Account", new AjaxOptions
    {
        HttpMethod = "POST",
        OnComplete = "create_Complete",
        OnBegin = "create_Begin"
    }))
{ %>
<!-- form stuff -->
<% } %>

$("form").submit(function() {
    $(":submit", this).attr("disabled", "disabled");
});
  • 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-16T05:06:13+00:00Added an answer on May 16, 2026 at 5:06 am

    Turns out it was a bug. See the edited question for the answer.

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

Sidebar

Related Questions

i have a form with 2 fields username: password: and a submit button. the
Can someone please clarify using a SIMPLE user story the full slice of what
My form is like this class SubmitForm(forms.Form): title = forms.CharField(max_length=100) story = forms.CharField(max_length=3000) #
I don't want to use wordpress (with wp-ecommerce plugin) or other full-featured store scripts
I am about to submit an iPhone application to the app store I want
i want to populate this json http://www.godsgypsychristianchurch.net/music.json using a get request, there are multiple
I have implemented product management system.I want to add one new features in which
I want to store the full access token in my site. Is it possible
We are planning to store millions of documents in MongoDB and full text search
Full disclosure: this is for an assignment, so please don't post actual code solutions!

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.