-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
53 lines (51 loc) · 1.68 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Vonq Assignment</title>
<link rel="stylesheet" href="vonqValidator.css">
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="wrapper">
<div class="title">Form</div>
<form class="form">
<div class="form-section">
<input type="text" placeholder="Name" class="vonqValidator" />
<input type="text" placeholder="Phone" />
<input type="email" placeholder="Email" class="vonqValidator" />
<input type="password" placeholder="Password" class="vonqValidator" />
</div>
<div class="form-section">
<input type="checkbox" id="terms" class="vonqValidator2" /><label for="terms">I accept the Terms of Service</label>
</div>
<div class="form-section">
<input type="button" id="submit" value="Submit">
</div>
</form>
</div>
</body>
<script type="text/javascript" src="vonqValidator.js"></script>
<script type="text/javascript">
var validator = new vonqValidator('vonqValidator')
.config({
minPasswordLength: 4,
passwordError: 'Passwords must contain lower and upper case letters',
requiredError: '<strong>Обязательное</strong> поле'
})
.setValidator('password', function(value) {
var lCase = value.search(/[a-z]/) !== -1;
var hCase = value.search(/[A-Z]/) !== -1;
return lCase && hCase;
});
var validator2 = new vonqValidator('vonqValidator2')
.config({
tooltipPosition: 'bottom'
});
var el = document.getElementById('submit');
el.addEventListener('click', function() {
validator.validate();
validator2.validate();
}, false);
</script>
</html>