Only submit a form once
Login or Register to Bookmark this snippet
This function disables all submit buttons on a form when it is submitted. Be warned, the disabled buttons are not passed as POST or GET variables when they have been disabled.
function submitonce(theform){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down submit and reset
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset") {
//disable em
tempobj.disabled=true
}
}
}
}
Added by JC on 11th November, 2007
There are no comments about this snippet.
You must be registered and logged in to post a comment.
Login here to post a comment