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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:03:18+00:00 2026-05-24T04:03:18+00:00

i have some requiredfieldvalidators. when i have a regular asp:button, all goes well. But,

  • 0

i have some requiredfieldvalidators.

when i have a regular asp:button, all goes well.

But, now we’ve implemented the OnClientClick event on the submit button:

<asp:Button ID="SaveButton" runat="server" Text="Save changes" OnClick="SaveButton_Click" OnClientClick="return SubmitForm2();" />

the submitform2 method is implemented to set the caption of the submitbutton (please wait) and to disable it to avoid double clicking.

  function SubmitForm2() {
        $("#SaveButton").attr("disabled", "true");
        $("#SaveButton").val("Please wait...");

        __doPostBack("SaveButton", "");
        return true;

    }

but what we see is when we run this code, the clientsidevalidators are not called.

is that because we run the __doPostBack ourselves, that otherwise other code (to check the validators) is fired?

  • 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-24T04:03:19+00:00Added an answer on May 24, 2026 at 4:03 am

    Yes – post-back is happening because you are doing __doPostBack by yourself. Once you disable the button, submit behavior by the button gets supressed blocking validators.

    One of better implementation of desired functionality could be to set the js-timer for short duration for disabling button and then for longer duration for enabling the button. For example,

    function SubmitForm2() {
            // disable button after 30 ms
            setTimeout(function() {
                $("#SaveButton").attr("disabled", "true");
                $("#SaveButton").val("Please wait...");
    
                // enable button in 15 seconds so that in case validations are 
                // failed, user can correct and re-submit the page.
                setTimeout(function() {
                   $("#SaveButton").removeAttr("disabled");
                   $("#SaveButton").val("Save");
                }, 15000); 
    
            }, 30);
    
            return true;
        }
    

    Even better implementation can be achieved by using validator’s client side API. Here’s one such simpler but better modification of previous one,

    function SubmitForm2() {
                // disable button after 30 ms
                setTimeout(function() {
                    $("#SaveButton").attr("disabled", "true");
                    $("#SaveButton").val("Please wait...");
    
                    // enable button in 1 second in case validations are 
                    // failed, user can correct and re-submit the page.
                    setTimeout(function() {
                       if (!Page_IsValid) {
                          // validations failed
                          $("#SaveButton").removeAttr("disabled");
                          $("#SaveButton").val("Save");
                       }
                    }, 1000); 
    
                }, 30);
    
                return true;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some ASP.NET web services which all share a common helper class they
Pretty simple question. I have a few ASP RequiredFieldValdators checking some text boxes. Out
I have some UI in VB 2005 that looks great in XP Style, but
I have some C# / asp.net code I inherited which has a textbox which
I have 2 asp.net textboxes in an update panel. Both textbox controls have some
Have some simple jquery that Im trying to execute on a button click. For
I have several RequiredFieldValidators in an ASP.NET 1.1 web application that are firing on
Have some text that needs to be replaced, searched around this website for all
So I have an ASP.NET/VB web application in which I'm using both RequiredFieldValidators and
I've got a simple form with some textboxes. These textboxes all have a RequiredFieldValidator.

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.