-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
190 lines (139 loc) · 5.75 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<title>Bootstrap form validation</title>
<meta name="description" content="Bootstrap 5 form validation using HTML5, CSS3 and Javascript.
Also implements RegEx and jQuery.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="Forms">
<meta property="og:type" content="">
<meta property="og:url" content="https://www.avdveen.nl/bs-form-validation/">
<meta property="og:image" content="">
<link rel="manifest" href="site.webmanifest">
<link rel="apple-touch-icon" href="icon.png">
<!-- Place favicon.ico in the root directory -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/main.css">
<meta name="theme-color" content="#fafafa">
</head>
<body>
<div class="container">
<div class="row">
<div class="header-style col-sm-12">
<h1>Bootstrap Form Validation</h1>
</div>
</div>
<div class="row">
<div class="col-sm-2">
<!-- gutter left -->
</div>
<div class="col-sm-8">
<form class="form-style">
<div class="row">
<div class="col-12">
<p>The form below is built in Bootstrap 5.0, using HTML5 and CSS3. The validation is
done through RegEx and written in Javascript (ECMAScript 6.0).
</p>
</div>
</div>
<div class="row">
<div class="col-6">
<input id="firstName" class="validate mb-3 form-control" type="text" aria-label="first-name"
placeholder="first name">
</div>
<div class="col-6">
<input id="lastName" class="validate mb-3 form-control" type="text" placeholder="last name">
</div>
</div> <!-- end of row -->
<div class="row">
<div class="col-6">
<input id="dateOfBirth" class="validate mb-3 form-control" type="text"
placeholder="dd-mm-yyyy (date of birth)">
</div>
<div class="col-6">
<input id="mobileNumber" class="validate mb-3 form-control" type="text" placeholder="mobile phone">
</div>
</div> <!-- end of row -->
<div class="row">
<div class="col-6">
<input id="landLine" class="validate mb-3 form-control" type="text" placeholder="land line">
</div>
<div class="col-6">
<input id="email" class="validate mb-3 form-control" type="text" placeholder="e-mail">
</div>
</div> <!-- end of row -->
<div class="row">
<div class="col-12">
<input id="iban" class="validate mb-3 form-control" type="text" placeholder="IBAN account number">
</div>
</div> <!-- end of row -->
<div class="row">
<div class="mb-3 col-12">
<div class="succes-msg collapse multi-collapse" id="multiCollapseExample1">
<div class="card card-body">
You input was validated.
Great success!
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<button type="button" id="submitButton" class="mb-3 btn btn-outline-success" disabled>Submit</button>
<button type="button" id="autoFillButton" class="mb-3 btn btn-outline-success">Auto-Fill</button>
<button type="button" id="showRegexButton" class="mb-3 btn btn-outline-success">RegEx</button>
</div>
</div> <!-- end of row -->
<div class="row">
<div class="mb-3 col-12">
<div class="regex-msg collapse multi-collapse" id="regexMsg">
<div class="card card-body">
<p>I used the following RegEx patterns:</p>
<p class="font-monospace">First name: /^[a-z ,.'-]+$/i</p>
<p class="font-monospace">Last name: /^[a-z ,.'-]+$/i</p>
<p class="font-monospace">Date of birth: /^[\d]{2}-[\d]{2}-[\d]{4}/i</p>
<p class="font-monospace">Mobile number: /^(\+|\d)[0-9]{7,16}$/i</p>
<p class="font-monospace">Land line = /^0[1-6]\d{1,2}\d{7}|^\+31[1-6]\d{1,2}\d{7}/i</p>
<p class="font-monospace">IBAN = <a href="https://math.stackexchange.com/questions/1918217/the-mod97-operation-in-iban-validation">See</a> explanation</p>
</div>
</div>
</div>
</div> <!-- end of row -->
</form>
</div>
<div class="col-sm-2">
<!-- gutter right -->
</div>
</div> <!-- end of row -->
</div> <!-- end of row -->
</div> <!-- end of container -->
<!-- js -->
<script src="js/vendor/modernizr-3.11.2.min.js"></script>
<script src="js/plugins.js"></script>
<script src="js/bootstrap.bundle.js"></script>
<script src="js/jquery-3.6.0.js"></script>
<script src="js/main.js"></script>
<!-- Google Analytics: change UA-XXXXX-Y to be your site's ID. -->
<script>
window.ga = function () {
ga.q.push(arguments)
};
ga.q = [];
ga.l = +new Date;
ga('create', 'UA-XXXXX-Y', 'auto');
ga('set', 'anonymizeIp', true);
ga('set', 'transport', 'beacon');
ga('send', 'pageview')
</script>
<script src="https://www.google-analytics.com/analytics.js" async></script>
<script>
$(document).ready(function () {
setUpValidation();
addEventListenerToButton("autoFillButton");
addEventListenerToButton("showRegexButton");
})
</script>
</body>
</html>