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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:10:48+00:00 2026-05-24T20:10:48+00:00

I have an controller which has check like that if (form[submit].ToString() == Continue) {

  • 0

I have an controller which has check like that

if (form["submit"].ToString() == "Continue")
{

}

and i have button which is doing submit

<button name="submit" value="Continue">Continue</button>

It was all working well until i decided to disable Continue button on submit to prevent double click using this function:

$('form').submit(function () {
                if ($(this).valid()) {
                    $(':submit', this).attr('disabled', 'disabled');
                }
            });

So now i don’t get value form["submit"] posted on controller.

Any thoughts how may i fix that?

I want still prevent second click but be able to get form["submit"] value posted on controller.

  • 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-24T20:10:48+00:00Added an answer on May 24, 2026 at 8:10 pm

    Can you control the submit value in a hidden field in the form? I can’t tell what other logic you might need, but when the form renders, you could set the hidden field’s value to the submit button’s value and change it when necessary using the first script below. As long as it has a name attribute and is enabled (which you’d rarely disable a hidden field) then it will post when the form is submitted.

    $(function() {
        // this assumes your button has id="myButton" attribute
        $(':hidden[name="submit"]').val($('#myButton').val());
    });
    

    And of course in your form, you would need a hidden field with name=”submit”

    <input type="hidden" name="submit" value="Continue" />
    

    Then, whenever the state of your form changes, modify the disabled state of the button and the value of the hidden field to reflect the value (if it changed at all).

    There are also frameworks you may find useful for UI features like this. KnockoutJS comes to mind. It can be used to “value” bind input elements. It’s probably overkill for this small example, but it could be useful if your UI expands. I’ve added markup, script and comments below if you’re interested.

    $(function () {
        var viewModel = {
            submitValue: ko.observable("Continue")
        };
    
        ko.applyBindings(viewModel);
    
        $('form').submit(function() {
            if($(this).valid()) {
                // the following line will change the both the hidden field's value
                // as well as the button's value attribute
                viewModel.submitValue("some other value");
    
                // I couldn't follow your selector here, but please note I changed 
                // the name of the submit button in the markup below.
                $(':submit, this).attr('disabled', 'disabled');
            }
        });
    });
    

    KnockoutJS requires you use the data-bind attribute to setup your elements. In your case, you’d bind one property to multiple elements like this:

    <button name="submitButton" data-bind="value: submitValue"/>Continue</button>
    <!-- and bind the same value similarly in the hidden field-->
    <input type="hidden" name="submit" data-bind="value: submitValue"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a controller which has a few actions, which are triggered by hitting
I have a question about forms. I have a fairly standard form that saves
We have a database that has been deployed to various clients. We are currently
I am creating application in MVC3. I have a ConferenceController which has a Create()
I have a check_user_access_control before_filter in my ApplicationController that checks the logged user's roles
I realise that there are other topics like this, but none of them really
Currently I am working on signing a 64-bit driver for a USB tool which
I've read a lot lately about TDD, but I've only seen small examples. Now
I'm trying to access related model info in Yii from a view and need
Part of my software build process includes getting the hash of the working directory

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.