.NET Validators Combined with Javascript

  • Thread starter Thread starter quiggle
  • Start date Start date
Q

quiggle

We have a need to ensure that users do not click multiple times on any
buttons that will submit the page. We have placed an onclick method on
all of them that counts how many times a submit like button has been
pressed, and if more than once, then there is an alert to the user, and
the subsequent submits are not processed.

Now here comes the interesting part...

We also have a few .NET validators on the page. If any of these
validators get tripped, and then the user tries to submit the page with
errors, and then corrects the problem, our handy dandy little onclick
will not let us continue because they have now pressed the button
twice. I was wondering if there is any way to tell from our
Javascript if the page is valid...

I attempted to call the Page_ClientValidate() method from our method,
and then check the Page_IsValid variable, which are in the
WebUIValidation.js file, but this didn't work.

Any help would be greatly appreciated!

Thanks!
 
the usual approach to preventing multi-submits is to simply disable the
button on the click event client-side. Why haven't you simplified your
routine to this?

--
Regards,
Alvin Bruney [Microsoft MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://www.lulu.com/owc
 
If we were to disable the button after they pressed it, and there
happen to be a validation error, then after the user fixed the problem,
the button would still be disabled, and they would not be able to
proceed.
 
but you realize this is the exceptional case that can be easily remedied
right?

--
Regards,
Alvin Bruney [Microsoft MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://www.lulu.com/owc
 
Back
Top