-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
executable file
·1124 lines (1103 loc) · 66 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
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
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Documentation | formJS - JavaScript Form Validation. Made Easy</title>
<meta name="description" content="JavaScript Form Validation. Made Easy">
<meta name="keywords" content="form, validation, javascript, plugin">
<meta name="author" content="Valerio Di Punzio">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://fonts.googleapis.com/css?family=Expletus+Sans:500|Raleway:200&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/doc.css">
<link rel="stylesheet" href="css/demo.css">
<link rel="stylesheet" href="css/prism.css">
<script defer src="js/prism.js"></script>
<!-- DYNAMICALLY LOAD POLYFILLS -> REQUIRED TO SUPPORT IE 10/11 AND SOME EDGE VERSIONS -->
<script defer src="https://cdn.polyfill.io/v3/polyfill.min.js?features=Array.from,Element.prototype.closest,Element.prototype.matches,Promise,Promise.prototype.finally,AbortController,fetch,CustomEvent"></script>
<script defer src="dist/additionals/utils.js"></script>
<script defer src="dist/formjs.min.js"></script>
<script defer src="dist/additionals/validationRules.js"></script>
<script defer src="dist/additionals/validationErrors.js"></script>
<script defer src="js/doc.js"></script>
<script defer src="js/include.js"></script>
</head>
<body>
<div id="top" class="container-fluid d-flex flex-column">
<div id="menu" class="position-sticky text-right d-flex">
<div class="position-relative w-100">
<a href="index.html" class="logo">f</a>
<nav class="position-absolute nav-desktop d-none d-md-flex align-items-center">
<a href="index.html" class="p-2 m-2">Home</a>
<a href="get-started.html" class="p-2 m-2">Get Started</a>
<a href="api.html" class="p-2 m-2">API</a>
<a href="demos.html" class="p-2 m-2">Demos</a>
<a href="https://github.com/SimplySayHi/formJS" target="_blank" class="github-logo ml-2">
<svg version="1.1" id="Livello_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="28px" height="28px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve">
<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M16,0.112c-8.836,0-16,7.294-16,16.291 C0,23.6,4.584,29.706,10.942,31.86c0.801,0.148 1.093-0.354,1.093-0.785c0-0.387-0.015-1.412-0.021-2.771 c-4.451,0.984-5.39-2.184-5.39-2.184c-0.729-1.881-1.777-2.383-1.777-2.383c-1.452-1.01,0.11-0.99,0.11-0.99 .605,0.115,2.45,1.68,2.45,1.68c1.428,2.488,3.745,1.77,4.657,1.354c0.145-1.053,0.559-1.771,1.016-2.178 c-3.553-0.412-7.288-1.809-7.288-8.051c0-1.778,0.623-3.232,1.646-4.371c-0.164-0.412-0.713-2.068,0.157-4.311 c0,0,1.344-0.438,4.399,1.67c1.276-0.361,2.646-0.543,4.006-0.549c1.359,0.006,2.728,0.188,4.006,0.549 c3.056-2.108,4.396-1.67,4.396-1.67c0.873,2.242,0.323,3.898,0.159,4.311c1.024,1.139,1.644,2.593,1.644,4.371 c0,6.258-3.74,7.635-7.305,8.038c0.574,0.504,1.086,1.498,1.086,3.018c0,2.178-0.02,3.934-0.02,4.469 c0,0.436,0.288,0.941,1.101,0.783C27.421,29.7,32,23.598,32,16.403C32,7.406,24.837,0.112,16,0.112z" />
</svg>
</a>
</nav>
<div class="position-absolute dropdown d-inline-block d-md-none">
<button class="btn dropdown-toggle dropdown-red-outline py-0 px-2" data-toggle="dropdown" type="button">
menu
</button>
<span class="dropdown-menu">
<a class="dropdown-item" href="index.html">Home</a>
<a class="dropdown-item" href="get-started.html">Get Started</a>
<a class="dropdown-item" href="api.html">API</a>
<a class="dropdown-item" href="demos.html">Demos</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="https://github.com/SimplySayHi/formJS" target="_blank">View on Github</a>
<a class="dropdown-item" href="https://github.com/SimplySayHi/formJS/issues" target="_blank">Report a Bug</a>
</span>
</div>
</div>
</div>
<div id="hero" class="d-flex flex-column justify-content-center">
<div class="row pt-5 justify-content-center">
<div id="intro" class="col-lg-6 text-center text-lg-left d-flex flex-column mt-4">
<div class="d-md-none">
<p class="d-inline-block my-4">
<a href="https://github.com/SimplySayHi/formJS" target="_blank" class="media">
<span class="media-body interline-normal">view on <br />Github</span>
<svg class="align-self-center ml-2" style="vertical-align: middle;" version="1.1" id="Livello_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve">
<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M16,0.112c-8.836,0-16,7.294-16,16.291 C0,23.6,4.584,29.706,10.942,31.86c0.801,0.148 1.093-0.354,1.093-0.785c0-0.387-0.015-1.412-0.021-2.771 c-4.451,0.984-5.39-2.184-5.39-2.184c-0.729-1.881-1.777-2.383-1.777-2.383c-1.452-1.01,0.11-0.99,0.11-0.99 .605,0.115,2.45,1.68,2.45,1.68c1.428,2.488,3.745,1.77,4.657,1.354c0.145-1.053,0.559-1.771,1.016-2.178 c-3.553-0.412-7.288-1.809-7.288-8.051c0-1.778,0.623-3.232,1.646-4.371c-0.164-0.412-0.713-2.068,0.157-4.311 c0,0,1.344-0.438,4.399,1.67c1.276-0.361,2.646-0.543,4.006-0.549c1.359,0.006,2.728,0.188,4.006,0.549 c3.056-2.108,4.396-1.67,4.396-1.67c0.873,2.242,0.323,3.898,0.159,4.311c1.024,1.139,1.644,2.593,1.644,4.371 c0,6.258-3.74,7.635-7.305,8.038c0.574,0.504,1.086,1.498,1.086,3.018c0,2.178-0.02,3.934-0.02,4.469 c0,0.436,0.288,0.941,1.101,0.783C27.421,29.7,32,23.598,32,16.403C32,7.406,24.837,0.112,16,0.112z" />
</svg>
</a>
</p>
</div>
<h1 class="align-self-center align-self-lg-start">formJS</h1>
<p class="claim">
JavaScript Form Validation. <br class="d-sm-none" />Made Easy
</p>
<p>
Use standard HTML to enable form superpowers.<br />
Need only basic powers? Try <span class="badge badge-pill badge-yellow">Lite</span> version.
</p>
<div>
<p class="d-inline-block mb-1">
Version
</p>
<div class="dropdown d-inline-block ml-1">
<button class="btn dropdown-toggle dropdown-red-outline py-0 px-2 bg-transparent" data-toggle="dropdown" type="button" data-print-current-version></button>
<span class="dropdown-menu w-100 py-1">
<a class="dropdown-item px-2" target="_blank" href="https://valeriodipunzio.com/plugins/formJS/4.4.0/">4.4.0</a>
<a class="dropdown-item px-2" target="_blank" href="https://valeriodipunzio.com/plugins/formJS/3.3.2/">3.3.2</a>
<a class="dropdown-item px-2" target="_blank" href="https://valeriodipunzio.com/plugins/formJS/2.3.3/">2.3.3</a>
<a class="dropdown-item px-2" target="_blank" href="https://valeriodipunzio.com/plugins/formJS/1.2.0/">1.2.0</a>
</span>
</div>
</div>
<div class="mt-auto">
<div class="mt-3">
<p class="m-0">
Only 7.6KB ( <span class="badge badge-pill badge-yellow">Lite</span> version 3.5KB ) minified & gzipped
</p>
<p class="m-0">
Download
<a href="https://github.com/SimplySayHi/formJS/archive/master.zip">Latest Version</a> |
<a href="https://github.com/SimplySayHi/formJS/releases" target="_blank">All Releases</a>
</p>
</div>
</div>
</div>
<div id="demo" class="col-md-9 col-lg-6 col-xl-5 mx-auto panel-collapsible mt-4">
<div class="card-body px-0 d-block">
<form action="json/data.json" name="my-form-4" class="nl-form">
<div class="nl-text-container d-flex flex-column">
<div class="nl-text-box nl-text-out align-self-start">
<p>
Need a break?
</p>
</div>
<div class="nl-text-box nl-text-in text-right align-self-end">
<p>Yep! I'd like to book <br />a room for </p>
<div data-formjs-question>
<select name="guests" class="custom-select" required>
<option value=""># people</option>
<option value="1">1 person</option>
<option value="2">2 people</option>
<option value="3">3 people</option>
<option value="4">4 people</option>
</select>
<div class="field-error-message small">how many guests?</div>
</div>
<p><br />in </p>
<div data-formjs-question>
<input name="city" type="text" class="form-control" placeholder="any city" required />
<div class="field-error-message small">where do you wanna go?</div>
</div>
<p>,<br />sleep there for </p>
<div data-formjs-question>
<input name="nights" type="number" inputmode="numeric" pattern="[0-9]*" data-subtype="number-integer" min="2" max="20" class="form-control" placeholder="# of" required />
<div class="field-error-message small">min 2, max 20</div>
</div>
<p>nights <br />starting from </p>
<div data-formjs-question>
<input name="start-date" type="date" data-subtype="date" class="form-control" placeholder="a date" required />
<div class="field-error-message small">when will you arrive?</div>
</div>
</div>
</div>
<button type="submit" class="btn btn-light btn-block">LET'S CHECK</button>
<div class="d-none alert my-4 text-center" role="alert" data-formjs-global-feedback></div>
</form>
</div>
</div>
</div>
</div>
<!-- Browsers Support -->
<div id="browsers-support">
<h3 class="sticky-title">Browsers Support</h3>
<p>
formJS is compatible with ( desktop & mobile versions ):
</p>
<ul>
<li>
Chrome
</li>
<li>
Firefox
</li>
<li>
Internet Explorer 10+ / Edge <span class="text-yellow">*</span>
</li>
<li>
Safari 9+ <span class="text-yellow">*</span>
</li>
</ul>
<hr />
<p>
<span class="text-yellow">*</span> for compatibility with IE, old versions of Edge and/or other old browsers you may need to load some JS polyfills ( from <a href="https://polyfill.io" target="_blank">polyfill.io</a> or else ):<br />
<code>Array.from</code> <code>Element.prototype.closest</code> <code>Element.prototype.matches</code> <code>Promise</code> <code>Promise.prototype.finally</code> <code>AbortController</code> <code>fetch</code> <code>CustomEvent</code>
</p>
<pre>
<code class="language-html"><script src="https://cdn.polyfill.io/v3/polyfill.min.js?features=Array.from,Element.prototype.closest,Element.prototype.matches,Promise,Promise.prototype.finally,AbortController,fetch,CustomEvent"></script></code></pre>
<div class="mt-3">
<p>
<span class="text-yellow">*</span> for <span class="badge badge-pill badge-yellow">Lite</span> version you may need these polyfills:<br />
<code>Array.from</code> <code>Element.prototype.closest</code> <code>Element.prototype.matches</code> <code>Promise</code> <code>CustomEvent</code>
</p>
</div>
</div>
<!-- Changelog -->
<div id="changelog">
<h3 class="sticky-title">Changelog</h3>
<ul class="p-0">
<li class="media my-3">
<div class="version-num text-red" data-print-current-version></div>
<div class="media-body pl-2">
<ul>
<li>
Add "modified" and "touched" to "cssClasses" for "fieldOptions" ( full version only )
</li>
<li>
Add "error" and "pending" to "cssClasses" for "formOptions" ( full version only )
</li>
<li>
Add "nestedMultipartDataToJSON" to "formOptions" to allow transformation of nested objects for FormData ( full version only )
</li>
<li>
Add "eslint" to dev dependencies
</li>
<li>
Add internal method to fix issue on sub-class initialization where "initialValues" was returned as empty object ( full version only )
</li>
<li>
Fix bug on multipart form management ( full version only )
</li>
<li>
Fix on form submit: css class for "submit" is now added after form validation and before submit instead of before form validation ( full version only )
</li>
<li>
Minor improvements
</li>
</ul>
</div>
</li>
</ul>
<div class="toggable-content-outer">
<input type="checkbox" class="fake-checkbox btn-toggable-content" id="changelog-show-more" />
<label class="toggable-label text-red" for="changelog-show-more">
<span>Show more</span>
<span>Close</span>
</label>
<div class="toggable-content">
<ul class="p-0">
<li class="media my-3">
<div class="version-num text-red">5.3.2</div>
<div class="media-body pl-2">
<ul>
<li>
Fix bug on "destroy" method: custom event listener for group validation was not removed ( full version only )
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">5.3.1</div>
<div class="media-body pl-2">
<ul>
<li>
Removed "dist/additionals" from .npmignore to allow import additionals
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">5.3.0</div>
<div class="media-body pl-2">
<ul>
<li>
Added "exports" to package.json in order to export also lite version and extra features
</li>
<li>
Add "utils" to exported items
</li>
<li>
Added option "groups" in "formOptions" to enable validation steps/groups ( full version only )
</li>
<li>
Added instance prop "currentGroup" ( full version only )
</li>
<li>
Added method "validateFieldsGroup" ( full version only )
</li>
<li>
Added event "fjs.group:validation" ( full version only )
</li>
<li>
Fixed bug on method "validateForm" to fire event "fjs.field:validation" for each filed after validation ( Lite version only )
</li>
<li>
Minor internal improvements
</li>
<li>
<span class="text-red">DEPRECATED</span> features ( will be dropped in v6 ):
<ul>
<li>
Support for IE and old browsers
</li>
<li>
SystemJS version
</li>
</ul>
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">5.2.0</div>
<div class="media-body pl-2">
<ul>
<li>
Added method "validateFilledFields" ( full version only )
</li>
<li>
Update "getFormData" to support object notation in fields name in returned js object ( full version only )
</li>
<li>
Added support for custom events for Lite version
</li>
<li>
Minor improvements
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">5.1.0</div>
<div class="media-body pl-2">
<ul>
<li>
Added "trimValue" in "fieldOptions" ( full version only )
</li>
<li>
Added argument "trimValues" for method "getFormData" ( full version only )
</li>
<li>
Added HTML attribute "data-field-options" to enable specific field options for single fields
</li>
<li>
Added "fieldOptions" to data passed to "beforeValidation" callback(s)
</li>
<li>
Re-introduced "maxFileSize" in "fieldOptions"
</li>
<li>
Re-introduced "fieldOptions" argument passed to validation rules
</li>
<li>
Fixed bug where css class(es) for "pending" were not removed when enabling "onValidationCheckAll" ( full version only )
</li>
<li>
<span class="text-red">DEPRECATED</span> features:
<ul>
<li>
HTML attribute "data-max-file-size" in favor of "maxFileSize" in "fieldOptions" and/or HTML attribute "data-field-options"
</li>
</ul>
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">5.0.2</div>
<div class="media-body pl-2">
<ul>
<li>
Enabled validation for "change" event only ( full version only )
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">5.0.1</div>
<div class="media-body pl-2">
<ul>
<li>
Exported main versions as UMD instead of IIFE for better environments compatibility
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">5.0.0</div>
<div class="media-body pl-2">
<ul>
<li>
Added event "fjs.form:init"
</li>
<li>
Added "onInitCheckFilled" in formOptions to run or not validation of filled fields on form init ( same as removed method "init" )
</li>
<li>
Changed Promise returned from methods "validateField" and "validateForm". Now if validation succeeds it will resolve with .then(), if validation fails it will reject with .catch()
</li>
<li>
Changed "fieldEl" with "$field" and "formEl" with "$form"
</li>
<li>
Changed key "stringLength" in favor of "length" in built-in errors
</li>
<li>
Removed method "init" in favor of option "onInitCheckFilled"
</li>
<li>
Removed "handleValidation" and "maxFileSize" in fieldOptions
</li>
<li>
Removed fieldOptions parameter in validation-rule methods
</li>
<li>
Removed "rule" in built-in errors
</li>
<li>
Moved option "handleFileUpload" from fieldOptions to formOptions for consistency
</li>
<li>
Moved "email" validation-error method from core to additionals ( external )
</li>
<li>
Switched usage of JS Event with CustomEvent
</li>
<li>
Minor improvements
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">4.4.0</div>
<div class="media-body pl-2">
<ul>
<li>
Added "trimValue" in "fieldOptions" ( full version only )
</li>
<li>
Added argument "trimValues" for method "getFotmData" ( full version only )
</li>
<li>
Added HTML attribute "data-field-options" to enable specific field options for single fields
</li>
<li>
Added "fieldOptions" to data passed to "beforeValidation" callback(s)
</li>
<li>
Fixed bug where "fieldOptions" argument was not declared in validation method for input type "file"
</li>
<li>
Fixed bug where css class(es) for "pending" were not removed when enabling fieldOptions.onValidationCheckAll ( full version only )
</li>
<li>
<span class="text-red">DEPRECATED</span> features:
<ul>
<li>
HTML attribute "data-max-file-size" in favor of "maxFileSize" in "fieldOptions" and/or HTML attribute "data-field-options"
</li>
</ul>
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">4.3.4</div>
<div class="media-body pl-2">
<ul>
<li>
Enabled validation for "change" event only ( full version only )
<br />
NOTE: This patch was released after publishing v5.0.0, so it's shipped in v5 only from v5.0.2
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">4.3.3</div>
<div class="media-body pl-2">
<ul>
<li>
Exported main versions as UMD instead of IIFE for better environments compatibility
<br />
NOTE: This patch was released after publishing v5.0.0, so it's shipped in v5 only from v5.0.1
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">4.3.2</div>
<div class="media-body pl-2">
<ul>
<li>
Fixed bug on fetch response not ok ( full version only )
</li>
<li>
Updated custom validation for username ( in external validations )
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">4.3.1</div>
<div class="media-body pl-2">
<ul>
<li>
Fixed bug for validation on "focus" event ( full version only )
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">4.3.0</div>
<div class="media-body pl-2">
<ul>
<li>
Added "event.data.isCheckingForm = true" for event "fjs.field:validation" emitted on validateForm() ( full version only )
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">4.2.3</div>
<div class="media-body pl-2">
<ul>
<li>
Added ESM version for additional validations and errors in dist folder
</li>
<li>
Minor improvements for full version only:
<ul>
<li>
Improved code in validateField when "onValidationCheckAll" is set to true
</li>
<li>
Calling method validateForm() will emit event "fjs.field:validation" for each validated field
</li>
<li>
When calling method init(), to avoid focus on related fields, focusOnRelated is set to false and then restored
</li>
<li>
Removed additional event emitted on form while validating a field since event emitted on field will bubble
</li>
</ul>
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">4.2.2</div>
<div class="media-body pl-2">
<ul>
<li>
Minor improvement after field validation when onValidationCheckAll is true
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">4.2.1</div>
<div class="media-body pl-2">
<ul>
<li>
Fixed bug on options merge when extending Form class
</li>
<li>
Updated dev dependencies
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">4.2.0</div>
<div class="media-body pl-2">
<ul>
<li>
Custom error key(s) are now dynamically added for each valdiation-rule based on validation-rule name
</li>
<li>
Fixed bug in method "init" where field "data-equal-to" was returned twice instead of its comparison field
</li>
<li>
Minor improvements
</li>
<li>
<span class="text-red">DEPRECATED</span> features:
<ul>
<li>
Method name "init" will be changed in the next major release
</li>
<li>
Key "stringLength" in favor of "length" in built-in errors
</li>
</ul>
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">4.1.0</div>
<div class="media-body pl-2">
<ul>
<li>
Added "questionContainer" in fieldOptions
</li>
<li>
Added "data-date-format" in combination with "min" and "max" attributes for custom date validation
</li>
<li>
Added Lite version of formJS
</li>
<li>
Added Jest tests
</li>
<li>
When valdiating a filed with method validateField and it's valid, the automatic form validation ( if "onValidationCheckAll" is set to true ) will skip this field
</li>
<li>
Now all validation rules and errors can be overridden
</li>
<li>
To improve consistency, now validations don't throw custom errors ( via new Error(...) in try/catch blocks ) anymore but default ones.
</li>
<li>
Internal improvements
</li>
<li>
<span class="text-red">DEPRECATED</span> features:
<ul>
<li>
fieldOptions.handleValidation
</li>
<li>
fieldOptions.maxFileSize
</li>
<li>
Email validation-error method
</li>
<li>
Key "rule" in built-in errors
</li>
<li>
"fieldOptions" parameter for validation rules
</li>
</ul>
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">4.0.1</div>
<div class="media-body pl-2">
<ul>
<li>
Replaced Webpack with Rollup
</li>
<li>
FormJS is now available as ES Module and SystemJS in "dist" folder and via CDNs
</li>
<li>
Reduced plugin size
</li>
<li>
Changed RegExp for email validation to check common email addresses instead of RFC5322 Official Standard
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">4.0.0</div>
<div class="media-body pl-2">
<ul>
<li>
Method "init" now returns a Promise
</li>
<li>
Added custom event listener for form submit
</li>
<li>
Added custom events to replace callback options ( but "onPastePrevented" )
<ul>
<li>
Removed callbacks "onPastePrevented" and "onValidation" from "fieldOptions"
</li>
<li>
Removed callbacks "onSubmitComplete", "onSubmitError" and "onSubmitSuccess" from "formOptions"
</li>
</ul>
</li>
<li>
Code refactoring to improve performances and reduce plugin size
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">3.3.2</div>
<div class="media-body pl-2">
<ul>
<li>
Fixed bug in "date" validation rule
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">3.3.1</div>
<div class="media-body pl-2">
<ul>
<li>
Fixed bug in method "validateField" when the field is not valid
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">3.3.0</div>
<div class="media-body pl-2">
<ul>
<li>
Added "cssClasses" in "formOptions" with "ajaxComplete", "ajaxError", "ajaxPending", "ajaxSuccess", "submit", "valid"
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">3.2.1</div>
<div class="media-body pl-2">
<ul>
<li>
Added "beforeValidation" in "fieldOptions"
</li>
<li>
Added "pending" to "cssClasses" in "fieldOptions"
</li>
<li>
Added "onValidationCheckAll" in "fieldOptions"
</li>
<li>
Now "beforeSend" in "formOptions" can also return an object instead of only a Promise
</li>
<li>
Now "onValidation" in "fieldOptions" is triggered every time a field is evaluated as valid ( to check the entire form validity )
</li>
<li>
Attribute "novalidate" is now forced to true
</li>
<li>
Updated dev dependencies
</li>
<li>
Minor updates and fixes
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">3.1.2</div>
<div class="media-body pl-2">
<ul>
<li>
Updated file .npmignore
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">3.1.1</div>
<div class="media-body pl-2">
<ul>
<li>
Project published on NPM.
</li>
<li>
Updated webpack config to export library as UMD Module.
</li>
<li>
Removed "FormJS" as alternative namespace.
</li>
<li>
Fixed bug in constructor function that caused an error when using the library as ES module.
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">3.1.0</div>
<div class="media-body pl-2">
<ul>
<li>
beforeSend callbacks are now promise-based
</li>
<li>
Added 2-ways validation for fields with attribute data-equal-to
</li>
<li>
Added validations for "alphabetic", "alphabeticExtended" and "Alphanumeric" to the external file /dist/additionals/validationRules.js
</li>
<li>
Simplified data returned in ajax response, now returning only the data coming from the call.
</li>
<li>
Moved validations for "numberFloat" and "numberInteger" to the external file /dist/additionals/validationRules.js
</li>
<li>
Minor bugfix and improvements
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">3.0.0</div>
<div class="media-body pl-2">
<b>NEW MAJOR VERSION</b>
<p class="mt-3 mb-0">
formJS is now available on <a href="https://www.jsdelivr.com/package/gh/simplysayhi/formJS" target="_blank">jsDelivr CDN</a>.
</p>
<p class="mt-3 mb-0">
formJS is now available in 2 versions ( the difference is only about the API used for AJAX calls ):
</p>
<ul>
<li>
fetch
</li>
<li>
XMLHttpRequest
</li>
</ul>
<p class="mt-3 mb-0">
Many relevant changes from the previous version:
</p>
<ul>
<li>
Added async validation with Promises.
</li>
<li>
Added built-in errors: prototype method "addValidationErrors" and object "validationErrors".
</li>
<li>
Added "errorEmpty" and "errorRule" to "cssClasses" in "fieldOptions" to show different error messages ( see implementation in CSS file ).
</li>
<li>
Added validation rules for:
<ul>
<li>
"color" ( input type="color" - as replace of "hexColor" )
</li>
<li>
"dateDDMMYYYY"
</li>
<li>
"tel" ( input type="tel" )
</li>
</ul>
</li>
<li>
Added support for attributes "min" and "max" for date fields.
</li>
<li>
Added "tempOptions" parameter to "onPastePrevented", "onValidation", "beforeSend", "onSubmitComplete", "onSubmitError", "onSubmitSuccess" callback functions.
</li>
<li>
Renamed method "getFormJSON" with "getFormData" ( and related option in "formOptions" ).
</li>
<li>
Renamed method "isValidField" with "validateField".
</li>
<li>
Renamed method "isValidForm" with "validateForm".
</li>
<li>
Renamed attribute "data-exclude-json" with "data-exclude-data" for consistency with related "getFormData" method.
</li>
<li>
Changed "ajaxData" parameter in "onSubmitComplete", "onSubmitError", "onSubmitSuccess" to be compliant with JSend standard.
</li>
<li>
Removed "Utilities" since it was going outside the plugin's scope.
</li>
<li>
Removed "submit" method since it was not so useful.
</li>
<li>
Removed the parameter from "getFormData" method. Now the function to collect data is taken in options.formOptions.getFotmData.
</li>
<li>
Removed "checkDirtyField" option from "fieldOptions" ( the related callback is automatically executed ).
</li>
<li>
Removed some polyfills thanks to code changes.
</li>
<li>
Minor improvements.
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">2.3.3</div>
<div class="media-body pl-2">
<ul>
<li>
Fixed a bug on fields "data-require-more"/"data-required-from".
</li>
<li>
Little improvement on submit method.
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">2.3.2</div>
<div class="media-body pl-2">
<ul>
<li>
Fixed a bug that caused field "data-required-from" to be validated even if not mandatory.
</li>
<li>
Fixed a bug that caused options functions ( in case on array of functions, like onValidation ) to be incorrectly merged.
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">2.3.1</div>
<div class="media-body pl-2">
<ul>
<li>
Fixed a bug that caused checkboxes and radios to be validated twice ( on Chrome ) if "validateOnEvents" option in "fieldOptions" was set to "change blur".
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">2.3.0</div>
<div class="media-body pl-2">
<ul>
<li>
Added "init" method.
</li>
<li>
Added validation for <code>data-type="number"</code> to emulate <code>type="number"</code> inputs ( see "strictHtmlValidation" option in Field Options section for details ).
</li>
<li>
Modified the JSON data returned from "getFormJSON" method in order to get a boolean in case of single checkbox field and an array of the strings in case of multi-checkbox ( in this case every checkbox MUST have a value set ). Same logic for select and multi-select fields.
</li>
<li>
Fixed a bug that caused a field with "maxlength" and "required" attributes to be evaluated as valid if the field value was empty.
</li>
<li>
If "checkDirtyField" option is set to true, the "dirty CSS class" will now be applied to the container element with "data-formjs-question" attribute - or the field itself ( as in previous versions ), if not.
</li>
<li>
Changed default option value for "fieldOptions.cssClasses.dirty" from "dirty-field" to "is-dirty".
</li>
<li>
Now the JS field element is passed to each validation rule as second argument.
</li>
<li>
Updated polyfill url to point to thw new v3.
</li>
<li>
Minor code improvements.
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">2.2.1</div>
<div class="media-body pl-2">
<ul>
<li>
Fixed a bug in "beforeSend" callback that prevented the script to be stopped even with "stopExecution" set ot true.
</li>
</ul>
</div>
</li>
<li class="media my-3">
<div class="version-num text-red">2.2.0</div>
<div class="media-body pl-2">
<ul>
<li>
Added "handleValidation" in "fieldOptions"
</li>
<li>
Added "ajaxOptions" in "formOptions"
</li>
<li>
Added "getFormJSON" in "formOptions"
</li>
<li>
Added "customFn" parameter to "getFormJSON" method
</li>
<li>
Moved "handleFileUpload" from "formOptions" to "fieldOptions" for options consistency
</li>
<li>
Removed support for attributes "data-ajax-settings" and "data-formjs-init". Use instead, respectively, "ajaxOptions" in "formOptions" and "handleValidation" in "fieldOptions" & "handleSubmit" in "formOptions"
</li>
<li>
"onPastePrevented" and "onValidation" in "fieldOptions" but also "beforeSend", "onSubmitComplete", "onSubmitError" and "onSubmitSuccess" in "formOptions" can now be a function or array of functions
</li>