-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathindex.html
More file actions
455 lines (424 loc) · 12.9 KB
/
index.html
File metadata and controls
455 lines (424 loc) · 12.9 KB
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
<!DOCTYPE html>
<html lang="de">
<head>
<title>Form validation</title>
<meta charset="utf-8">
<link rel="stylesheet" href="/style/common.css" />
<script src="/bundle.min.js"></script>
<style>
input:required {
border: 1px solid red;
}
time.output-field {
min-width: 6em;
height: 2em;
padding: 0 0.5em;
background: lightgrey;
box-sizing: border-box;
display: inline-block;
}
time.output-field:not(.disabled) {
cursor: pointer;
}
.cancel-button {
display: inline-block;
width: 1em;
height: 1em;
margin-left: 0.2em;
background-color: blue;
}
</style>
</head>
<body>
<form class="pat-validation vertical"
action="."
method="get"
data-pat-validation="disable-selector: .pat-button"
>
<fieldset class="horizontal">
<label>Full name
<input autocomplete="off"
name="name"
required
type="text"
/></label>
<label>Age
<input autocomplete="off"
max="65"
min="16"
name="age"
required
type="number"
/></label>
<label>Real number, limited between 10.0 and 10.9, with a step of 0.1.
<input autocomplete="off"
max="10.9"
min="10.0"
name="real"
step="0.1"
type="number"
/></label>
<label>Real number, limited between 10.0 and 10.9, with a step of ``any``.
<input autocomplete="off"
max="10.9"
min="10.0"
name="real"
step="any"
type="number"
/></label>
<label>URL
<input autocomplete="off"
name="url"
type="url"
placeholder="https://example.com"
/></label>
<label>E-mail
<input autocomplete="off"
name="email"
type="email"
/></label>
<fieldset class="group pat-checklist radio">
<legend>Favourite colour</legend>
<label><input autocomplete="off"
name="colour"
required
type="radio"
value="blue"
/>
Blue</label>
<label><input autocomplete="off"
name="colour"
required
type="radio"
value="pink"
/>
Pink</label>
<label><input autocomplete="off"
name="colour"
required
type="radio"
value="red"
/>
Red</label>
<label><input autocomplete="off"
name="colour"
required
type="radio"
value="yellow"
/>
yellow</label>
</fieldset>
<label>Planning start
<input class="pat-date-picker"
id="planning-start"
autocomplete="off"
name="measure.planning_start:records"
type="date"
value="2015-10-10"
data-pat-validation="not-after: #planning-end; message-date: This date must be on or before the end date."
/>
</label>
<label>Planning end
<input class="pat-date-picker"
id="planning-end"
autocomplete="off"
name="measure.planning_end:records"
type="date"
value="2015-09-09"
data-pat-validation="not-before: #planning-start; message-date: This date must be on or after the start date."
/>
</label>
<label>Required date
<input id="date-required"
autocomplete="off"
name="measure.date-required:records"
required
type="date"
/>
</label>
<label>Optional date
<input id="date-optional"
autocomplete="off"
name="measure.date-optional:records"
type="date"
/>
</label>
<label>Disabled start
<input class="pat-date-picker"
id="disabled_start"
autocomplete="off"
disabled
name="disabled_start"
type="date"
value="2021-04-21"
data-pat-validation="not-after: #planning-end; message-date: This date must be on or before the end date."
/>
</label>
<label>End
<input class="pat-date-picker"
id="disabled_end"
autocomplete="off"
name="disabled_end"
type="date"
data-pat-validation="not-before: #disabled_start; message-date: This date must be on or after the start date."
/>
</label>
<hr />
<label>Date/Time start
<input
id="datetime-start"
autocomplete="off"
name="datetime-start"
type="datetime-local"
value="2022-01-05T10:00"
data-pat-validation="not-after: #datetime-end; message-date: This date/time must be on or before the end date/time."
/>
</label>
<label>Date/Time end
<input
id="datetime-end"
autocomplete="off"
name="datetime-end"
type="datetime-local"
value="2022-01-05T14:00"
data-pat-validation="not-before: #datetime-start; message-date: This date/time must be on or after the start date/time."
/>
</label>
<hr />
<label>Password
<input id="password"
autocomplete="off"
name="password"
type="password"
/>
</label>
<label>Password confirmation
<input id="password-confirmation"
autocomplete="off"
name="password-confirmation"
type="password"
data-pat-validation="equality: password; message-equality: This field needs to be equal to %{attribute}"
/>
</label>
<label>Food preference
<input class="pat-autosuggest"
id="a1"
autocomplete="off"
name="a1"
placeholder="Pick some fruit"
required="required"
type="text"
data-pat-autosuggest="words: Apples, Oranges, Pears, Bananas; maximum-selection-size: 1"
/>
</label>
<label>Custom template
<input autocomplete="off"
name="custom-template"
required
type="text"
data-pat-validation="error-template: <h1 class='validation-error'>${this.message}</h1>"
/></label>
<fieldset class="buttons">
<button class="pat-button">Test</button>
<button>Submit</button>
<button formnovalidate>Cancel</button>
</fieldset>
</fieldset>
</form>
<h2>Demo with max-values / min-values support</h2>
<form class="pat-validation pat-checklist"
action="."
method="post"
>
<fieldset>
<legend>Multi select</legend>
<select
name="select"
multiple
required
data-pat-validation="
min-values: 2;
max-values: 3;
"
>
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
<option value="d">d</option>
</select>
</fieldset>
<fieldset>
<legend>Multiple checkboxes</legend>
<label>
a
<input
type="checkbox"
name="checkbox[]"
value="a"
data-pat-validation="
min-values: 1;
max-values: 3;
"
/>
</label>
<label>
b
<input
type="checkbox"
name="checkbox[]"
value="b"
data-pat-validation="
min-values: 1;
max-values: 3;
"
/>
</label>
<label>
c
<input
type="checkbox"
name="checkbox[]"
value="c"
data-pat-validation="
min-values: 1;
max-values: 3;
"
/>
</label>
<label>
d
<input
type="checkbox"
name="checkbox[]"
value="d"
data-pat-validation="
min-values: 1;
max-values: 3;
"
/>
</label>
</fieldset>
<fieldset
data-pat-validation="
min-values: 2;
max-values: 3;
"
>
<legend>Demo with mixed inputs and max/min values support.</legend>
<fieldset>
<select
name="multiple"
multiple
>
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
<option value="d">d</option>
</select>
</fieldset>
<fieldset>
<label>
a
<input
type="checkbox"
name="multiple"
value="a"
/>
</label>
<label>
b
<input
type="checkbox"
name="multiple"
value="b"
/>
</label>
<label>
c
<input
type="checkbox"
name="multiple"
value="c"
/>
</label>
<label>
d
<input
type="checkbox"
name="multiple"
value="d"
/>
</label>
</fieldset>
<fieldset>
<label>
input 1
<input name="multiple"/>
</label>
<label>
input 2
<input name="multiple"/>
</label>
<label>
input 3
<input name="multiple"/>
</label>
</fieldset>
</fieldset>
<fieldset class="buttons">
<button>Submit</button>
<button formnovalidate>Cancel</button>
</fieldset>
</form>
<div class="pat-modal">
<form class="pat-inject vertical pat-validation"
action="."
method="get"
data-pat-validation="disable-selector: [type=submit], button:not([type=button])"
>
<fieldset class="horizontal">
<label>First of all!
<input name="first"
required
autocomplete="off"
/></label>
<label>Optional subtext
<input name="optional"
autocomplete="off"
/></label>
<label>Start
<input class="pat-date-picker"
name="mod-3"
type="date"
required
autocomplete="off"
data-pat-validation="not-after: [name=mod-4]"
/>
</label>
<label>End
<input class="pat-date-picker"
name="mod-4"
type="date"
required
autocomplete="off"
data-pat-date-picker="after: [name=mod-3]"
data-pat-validation="not-before: [name=mod-3]"
/>
</label>
<label>Preference
<input class="pat-autosuggest"
name="mod-5"
required
autocomplete="off"
data-pat-autosuggest="words: Gibson, Fender, Washburn, Strandberg"
/>
</label>
</fieldset>
<fieldset class="buttons">
<button class="close-panel" type="submit">Submit</button>
<button class="close-panel" type="button" formnovalidate>Cancel</button>
</fieldset>
</form>
</div>
</body>
</html>