Snippets v2

Languages
My Snippets

Only submit a form once Login or Register to Bookmark this snippet

Description Javascript

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.

The Code Download
  1. function submitonce(theform){
  2.     //if IE 4+ or NS 6+
  3.     if (document.all||document.getElementById){
  4.         //screen thru every element in the form, and hunt down submit and reset
  5.         for (i=0;i<theform.length;i++){
  6.             var tempobj=theform.elements[i]
  7.             if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset") {
  8.                 //disable em
  9.                 tempobj.disabled=true
  10.             }
  11.         }
  12.     }
  13. }
Credits Contact JC

Added by JC on 11th November, 2007

Comments

There are no comments about this snippet.

Post Comment HTML is allowed

You must be registered and logged in to post a comment.

Login here to post a comment