This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Disabling Submit Button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Disabling Submit Button" Watch "Disabling Submit Button" New topic

Disabling Submit Button

Kashyap Jani

Joined: Dec 04, 2002
Posts: 1
I have a submit button image which i need to disable once pressed. I can disable an normal image but not the submit button. I'm using the following code to disable the image :
But the above code doesn't work for input type=image button. Is there anyway i can disable the submit button so that the user does not click submit the form twice.
Any help would be appreciated.
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
I personally would use an input button
you can use a session cookie with this script too.
Note take the _ out of on_click
var AllowIt=true;
function SubIt(){
alert('This form should only be submitted once');
<form name="formname">
<input type="button" value="submit" name="Button" on_click="subIt()">
I agree. Here's the link:
subject: Disabling Submit Button
jQuery in Action, 3rd edition