troubleshooting Question

Need to check for ASP.NET Validation result client side (before hits the server)...

Avatar of Cognize
Cognize asked on
3 Comments1 Solution387 ViewsLast Modified:

I've noticed a bug where a user is able to click the submit button on a form twice before the page returns, which is having an unwanted affect. Why the page is allowed to submit twice (cutting off the processing of the previous request - I'm not sure).

I've seen similar posts, which suggest disabling the button with javascript. This is what I'm doing for now essentially, but with a timer to re-enable the button if the form doesn't validate client side. This is a less than perfect solution though.

The reason I have to disable and re-enable client side, is that if the form validation fails client side, I have to re-enable the button so the user can edit input and re-submit using the code below.

What id prefer is a way of checking validation results in code, on the client side, so I can disable on the initial click, and then re-enable if the form validation fails, so the user can have another go.

Does anyone know how to test for this?
function disableButton() {
                                        var buttonDiv = document.getElementById('regBtnDiv');
                               = "hidden";
                               = "0px";
                                        var msgDiv = document.getElementById('validatingMessage');
                               = "visible";
                               = "20px";
                                        setTimeout('showButton()', 2000);
                                    function showButton() {
                                        var buttonDiv = document.getElementById('regBtnDiv');
                               = "visible";
                               = "auto";
                                        var msgDiv = document.getElementById('validatingMessage');
                               = "hidden";
                               = "0px";

Open in new window


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 3 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 3 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004