Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Disabling Submit Button

 
Kashyap Jani
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic