My script throw errors:
TypeError: jQuery.validator is undefined additional-methods.js:20 TypeError: $(...).validate is not a function index.php:115
Probably, I have mistake in jQuery code.
<head>
<script type="text/javascript" src="js/jquery-1.10.2.js"></script>
<script type="text/javascript" src="js/jquery.form.js"></script>
<script src="http://jquery.bassistance.de/validate/additional-methods.js"></script>
</head>
<body>
<form id="registerForm" method="post" action="logrej.php">
<input name="login" type="text"/>
<input name="nick" type="text"/>
<input type="password" id="passw" name="password"/>
<input type="password" name="retype" />
<input type="submit" value="Zarejestruj!" />
</form>
<script>
$("#registerForm").validate({
rules: {
login: {
required:true,
rangelenght: [4,20],
remote:"look.php"
},
nick : {
required:true,
rangelenght:[4,20],
remote:"look.php"
},
password: {
required:true,
rangelenght:[4.20]
},
retype: {
required:true,
equalTo:"#passw"
}
},
messages:{
login:{
required:"To pole jest wymagane!"
}
}
})
</script>
You're not loading the validation plugin. You need:
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
Put this before the line that loads the additional methods.
Also, you should get the additional methods from the CDN as well, rather than jquery.bassistance.de.
Other errors:
[4.20]
should be
[4,20]
and
rangelenght:
should be:
rangelength: