Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: Beginner
Sep 4, 2001

Restricting Users' Ability to Click a Submit Button


Clicking a submit button on a Web form can create havoc. Here is an easy way to restrict a Web user from clicking the submit button more than once. Once they fill out the form, button is disabled and the text changes to "Thanks".
 
<html>
<head>
<script language="javascript">
function doit()   {
	alert("here");
	document.form1.button.value="thanks";
	document.form1.button.disabled = true
}
</script>
</head>
<body>
<form name="form1">
  <input type="text" name="email">
  <input type="submit" name="button" value="Submit" 
onclick="doit()">
</form>

</body>

</html>
John Ault
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date