aspose file tools*
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
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Disabling Submit Button" Watch "Disabling Submit Button" New topic
Author

Disabling Submit Button

Kashyap Jani
Greenhorn

Joined: Dec 04, 2002
Posts: 1
Hi,
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 :
formName.imageName.disabled=true;
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.
Thanx
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I personally would use an input button
you can use a session cookie with this script too.
Note take the _ out of on_click
<script>
var AllowIt=true;
function SubIt(){
if(AllowIt){
AllowIt=false;
document.formname.submit();
}
else{
alert('This form should only be submitted once');
}
}
</script>
<form name="formname">
<input type="button" value="submit" name="Button" on_click="subIt()">
</form>
 
Don't get me started about those stupid light bulbs.
 
subject: Disabling Submit Button