hi every one![]()
i need a javasript that will allow user to click on the button once, after it it may disable the button.
please help.
thanks
hi every one![]()
i need a javasript that will allow user to click on the button once, after it it may disable the button.
please help.
thanks
HTML Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form> <input name="Button" type="button" onClick="this.disabled = 'true';" value="Press Me"> </form> </body> </html>
thanks budd
well i tried to disabled the submit button through onclick but i prevents my form from submition instead i worked this way and have made it![]()
<SCRIPT LANGUAGE="JavaScript">
var submitcount=0;
function checkFields()
{
if (submitcount == 0)
{
submitcount++;
return true;
}
else
{
alert("This form has already been submitted. Thanks!");
return false;
}
}
</script>
and...
<html:form action="/someAction" onsubmit="return checkFields()">
Changing the attribute value to:Originally Posted by codeexploiter
  this.disabled = 'false';
would still disable the control.
Don't. If the submission fails and the user needs to resubmit, the button may still be disabled when they use the Back button to return (this behaviour varies between browsers, but does occur).Originally Posted by Jamal
If multiple submissions breaks your server-side code, then that code is broken itself. Detect and deal with it properly on the server.
Mike
Or you could use DD's scripts: http://www.dynamicdrive.com/dynamici...sableenter.htm
Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
Currently: enjoying the early holidays :)Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide
Bookmarks