Total members 11895 |It is currently Sun Dec 22, 2024 4:01 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





avoid multiple submit Example, prevent more than one press on submit button in form code example using JQuery.
javascript code
<html>
<head>
<title>avoid multiple submit Example</title>

<!--
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
Note you can download the JQuery package instead of using Google version. -->
<script src="jquery-1.8.3.js"></script>
<script>
$(document).ready(function() {
$('form#Once').submit(function() {
if(typeof jQuery.data(this, "disabledOnSubmit") == 'undefined') {
jQuery.data(this, "disabledOnSubmit", { submited: true });
$('input[type=submit], input[type=button]', this).each(function() {
$(this).attr("disabled", "disabled");
});
return true;
}
else
{
return false;
}
});
});
</script>


</head>
<body>
<center>
<form action="#" method="GET" id="Once">
<table border="1">
<tr>
<td><strong>username:</strong></td><td><input type="text" name="username" />
</tr>
<tr>
<td><strong>password:</strong></td><td><input type="text" name="password" />
</tr>
<tr>
<td colspan="2">
<center><input type="submit" value="submit" />
</td>

</form>
</center>

</body>

</html>




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : avoid multiple submit of form, prevent more than one press
 avoid multiple submit clicks using javascript     -  
 Disable submit button until all form's fields are filled     -  
 How Can I Avoid Domain Renewal Problems?     -  
 avoid showing/printing figures, text after conclusion     -  
 php login form (sign-in form)     -  
 Multiple Inheritance     -  
 Using Multiple Values for a Cookie in php     -  
 Jtable with multiple headings     -  
 Multiple Exception Catching     -  
 Code to open multiple links.     -  



Topic Tags

JQuery GET/POST
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com