-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.pre.html
executable file
·74 lines (64 loc) · 1.91 KB
/
index.pre.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Forminator</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<style type="text/css">
body {
font-family: Arial, Helvetica, sans-serif;
color: rgb(41, 41, 41);
}
.frm-name {
border: 1px solid white;
padding: 0.2em;
}
.frm-name.error {
border: 1px solid rgb(232, 37, 37);
}
.frm-name.success {
border: 1px solid green;
}
.frm-name.error .frm-global-feedback, .frm-group.error * {
color: rgb(232, 37, 37);
}
.frm-name.success .frm-global-feedback {
color: green;
}
</style>
</head>
<body>
<!-- @include html/form.html -->
<script src="lib/jquery-1.11.0"></script>
<script src="forminator.js"></script>
<script>
var nameForminator = forminator.init({
name: 'name',
validate: function (data) {
var errors = {};
if(data.text.length > 3) {
errors.text = '3 character maximum';
}
else if(data.text === 'foo') {
errors.text = 'cannot be "foo"';
}
if(errors.text) {
errors.GLOBAL = 'An error occured.';
}
return errors;
},
success: function (response) {
this.reset();
setTimeout(this.clearFormFeedback, 2000);
},
error: function (response) {
console.log('error', arguments, this);
},
complete: function (response) {
console.log('complete', arguments, this);
}
});
</script>
</body>
</html>