user1017882
user1017882

Reputation:

Disabling button client-side if page is valid

I'd like to disable an 'Upload' button if the page is valid in javascript.

The button itself causes validation, and there's a mix of validators (required field validators, regex validators etc.).

Any ideas??

Upvotes: 0

Views: 811

Answers (2)

user1017882
user1017882

Reputation:

The only solution I've found here is to scrap the ASP validators and implement my own big custom javascript validation on the clientclick events.

Upvotes: 0

Brian Mains
Brian Mains

Reputation: 50728

Yes, i've had that issue before. As the page is posting back to the server, just disable the button altoghether:

document.getElementById("button").disabled = true;

Or hide it:

document.getElementById("button").style.display = "none";

And then they can't click on it again.

Upvotes: 1

Related Questions