I have known good working JS validation functions (validated all the way back to OnClientClick). When called by OnClientClick, they check whether all the required fields have been populated, disable the submit button, and return the correct true/false validation to OnClientClick.
The problem is in disabling the button. The page submits and reloads, but the OnClick event is not fired. Remarking the
document.getElementById("<%=btnSubmit.ClientID %>").disabled = true;
code allows the OnClick event to fire.
I have tried inserting
this.disabled=true;
directly into OnClientClick, as well as using UseSubmitBehavior=false.
Why does the OnClick event not fire when the button is disabled?
two things:
1 make sure 'disabled' attribute is not set. Try removing the attribute by
2 OnClick post back should be able to run if you call:
basically it forces the browser to send the request as OnClick is server side method.