faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

9 of 19 people (47%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

How can I disable a user from clicking a image (used to submit a form) multiple times ?

Apr 5th, 2008 20:10
ha mo, Simon Burnett, Rohit Kulkarni,


How about using a variable defined at the top of the SCRIPT area: 
var iAlreadySubmitted = 0
Then instead of using the submit() method (which i assume you are 
using) call another function such as this one:
function doCheck(){
  if  (iAlreadySubmitted==0){
     // submitting for first time - set flag to stop extra submissions
     iAlreadySubmitted=1
     // submit the form
     frmName.submit()
  }
}
Hope this helps.
Simon
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com