Hi, I was wondering if there is some built in way of disabling a submit button after it has been clicked.
And, if there is no default way, how should I do this.
I found something like this to put in DisableSubmit.js:
function DisableButton() {
document.forms[0].submit();
window.setTimeout("disableButton('" + window.event.srcElement.id + "')", 0);
}
function disableButton(buttonID) {
document.getElementById(buttonID).disabled=true;
}
And then this in the page load:
btnSo.Attributes.Add("onclick", "DisableButton()")
And I thought of something like in the page init:
Dim objCSS As Control = Me.Page.FindControl("CSS")
If Not objCSS Is Nothing Then
Dim objScript As New HtmlGenericControl("script")
objScript.Attributes("language") = "javascript"
objScript.Attributes("type") = "text/javascript"
objScript.Attributes("src") = "/desktopmodules/[MODULENAME]/DisableSubmit.js"
objCSS.Controls.AddAt(0, objScript)
End If
But it doesn't seem to work...