So I'm using Validate.js to validate my forms through the front-end. But for some weird reason the errors are not being displayed. I'm also not sure if they're being validated to begin with. Any ideas?
Heres my code:
<html>
<head>
<script type="text/javascript" src="validate.js"></script>
</head>
<body>
<form id="form1">
<input type="text" name="name" placeholder="Name"><br>
<input type="text" name="email" placeholder="Email"><br>
<input type="password" name="password" placeholder="Password"><br>
<input type="submit" value="Submit">
</form>
<script>
var validator = new FormValidator('form1', [{
name: 'name',
display: 'required',
rules: 'required'
}, {
name: 'email',
rules: 'valid_email'
}, {
name: 'password',
rules: 'required'
}, {
name: 'password_confirm',
display: 'password confirmation',
rules: 'required|matches[password]'
}], function(errors, event) {
if (errors.length > 0) {
// Show the errors
}
});
</script>
</body>
</html>