Skip to content

Instantly share code, notes, and snippets.

@rnavarro
Created June 4, 2011 23:17
Show Gist options
  • Save rnavarro/1008476 to your computer and use it in GitHub Desktop.
Save rnavarro/1008476 to your computer and use it in GitHub Desktop.
Fixed
<html>
<head>
<title>Testing Fucking Forms onSubmit</title>
<script src="http://code.jquery.com/jquery-1.6.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(undefined) {
$('#someForm').submit(function() {
var canSumbit = true;
$('input.tester').each(function() {
if($(this).val().length != 4) {
canSumbit = false;
}
});
return canSumbit;
});
});
</script>
</head>
<body>
<?php
print_r($_POST);
?>
<form id="someForm" method="POST" action="index.php">
<input class="tester" type="text" name="testing1" value="1" />
<input class="tester" type="text" name="testing2" value="2" />
<input class="tester" type="text" name="testing3" value="3" />
<input type=text" name="tester2" />
<input type="submit" value="submit" name="submit" />
</form>
<body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment