<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form class="form" name="form">
<input type="text" class="name" name="">
<span class="validator-error-span"></span>
<input type="password" class="password" name="">
<span class="validator-error-span"></span>
<input type="text" class="email" name="">
<span class="validator-error-span"></span>
<input type="submit" value="Send" name="">
</form>
<script type="text/javascript" src="../jquery/jquery.js"></script>
<script type="text/javascript" src="validator.js"></script>
<script type="text/javascript">
var validator = new Validator('form').configure(
[
{
required: true,
input: '.name',
errorType: 'default',
minLength: 5,
match: new RegExp(/^[a-z]/)
},
{
input: '.password',
required: true,
errorType: 'default'
},
{
input: '.email',
required: true,
errorType: 'default'
}
],
).onFormSubmit(function(form) {
validator.log(form);
}).validate();
</script>
</body>
</html>
|