Home arrow Articles arrow Disabling sudmit button to avoid unncecessary submits
Disabling sudmit button to avoid unncecessary submits PDF Print E-mail
Written by Administrator   
Saturday, 27 October 2007
If you have been on ebay you will notice that when you click on certain buttons they are grayed out and you cannot click on them anymore. This is a feature used to prevent users from sudmitting a form more than once. Here is how it works. I going to right a function which you have to put in your js file or script header which will be executed on the forms onSubmit even.

Javascript Code:
 
function disableSubmitButton(formname) {
 for(
i=0;i
     
if(formname.elements[i].type == "submit"){
        
formname.elements[i].disabled true
        
break;
        }
      }
   } 

now to execute this function you simply added to the forms onsubmit. with the form as its only argument



Add to favourite articles (35) | Place this article on your website | Views: 289

Comment on this article
RSS comments

Only registered users can write comments.
Please login or register.

blabh
Last Updated ( Thursday, 22 November 2007 )