1
- [ ![ GitHub release] ( https://img.shields.io/github/release/scriptex/html5-form-validator.svg )] ( https://github.com/scriptex/html5-form-validator/releases/latest )
2
- [ ![ GitHub issues] ( https://img.shields.io/github/issues/scriptex/html5-form-validator.svg )] ( https://github.com/scriptex/html5-form-validator/issues )
3
- [ ![ GitHub last commit] ( https://img.shields.io/github/last-commit/scriptex/html5-form-validator.svg )] ( https://github.com/scriptex/html5-form-validator/commits/master )
4
- [ ![ Github file size] ( https://img.shields.io/github/size/scriptex/html5-form-validator/dist/index.min.js.svg )] ( https://github.com/scriptex/html5-form-validator )
5
- [ ![ Build Status] ( https://travis-ci.com/scriptex/html5-form-validator.svg?branch=master )] ( https://travis-ci.com/scriptex/html5-form-validator )
6
- [ ![ npm] ( https://img.shields.io/npm/dt/html5-form-validator.svg )] ( https://www.npmjs.com/package/html5-form-validator )
7
- [ ![ npm] ( https://img.shields.io/npm/v/html5-form-validator.svg )] ( https://www.npmjs.com/package/html5-form-validator )
8
- [ ![ Analytics] ( https://ga-beacon.appspot.com/UA-83446952-1/github.com/scriptex/html5-form-validator/README.md )] ( https://github.com/scriptex/html5-form-validator/ )
1
+ [ ![ Travis CI] ( https://travis-ci.com/scriptex/html5-form-validator.svg?branch=master )] ( https://travis-ci.com/scriptex/html5-form-validator )
2
+ [ ![ Github Build] ( https://github.com/scriptex/html5-form-validator/workflows/Build/badge.svg )] ( https://github.com/scriptex/html5-form-validator/actions?query=workflow%3ABuild )
3
+ [ ![ Codacy Badge] ( https://app.codacy.com/project/badge/Grade/34d3d75710534dc6a38c3584a1dcd068 )] ( https://www.codacy.com/gh/scriptex/html5-form-validator/dashboard?utm_source=github.com&utm_medium=referral&utm_content=scriptex/html5-form-validator&utm_campaign=Badge_Grade )
4
+ [ ![ Codebeat Badge] ( https://codebeat.co/badges/d765a4c8-2c0e-44f2-89c3-fa364fdc14e6 )] ( https://codebeat.co/projects/github-com-scriptex-html5-form-validator-master )
5
+ [ ![ CodeFactor Badge] ( https://www.codefactor.io/repository/github/scriptex/html5-form-validator/badge )] ( https://www.codefactor.io/repository/github/scriptex/html5-form-validator )
6
+ [ ![ DeepScan grade] ( https://deepscan.io/api/teams/3574/projects/5257/branches/40799/badge/grade.svg )] ( https://deepscan.io/dashboard#view=project&tid=3574&pid=5257&bid=40799 )
7
+ [ ![ Analytics] ( https://ga-beacon-361907.ew.r.appspot.com/UA-83446952-1/github.com/scriptex/html5-form-validator/README.md?pixel )] ( https://github.com/scriptex/html5-form-validator/ )
9
8
10
9
# HTML5 Form Validator
11
10
12
- The simplest HTML5 forms validator
11
+ > The simplest HTML5 forms validator.
12
+
13
+ This form validator uses the ** built-in capabilities** of the browser to validate the required form fields.
14
+
15
+ All validation messages are shown as they are shown by the browser which means that they are ** internationalized** and are ** NOT subject to change** .
16
+
17
+ ## Visitor stats
18
+
19
+ ![ GitHub stars] ( https://img.shields.io/github/stars/scriptex/html5-form-validator?style=social )
20
+ ![ GitHub forks] ( https://img.shields.io/github/forks/scriptex/html5-form-validator?style=social )
21
+ ![ GitHub watchers] ( https://img.shields.io/github/watchers/scriptex/html5-form-validator?style=social )
22
+ ![ GitHub followers] ( https://img.shields.io/github/followers/scriptex?style=social )
23
+
24
+ ## Code stats
25
+
26
+ ![ GitHub code size in bytes] ( https://img.shields.io/github/languages/code-size/scriptex/html5-form-validator )
27
+ ![ GitHub repo size] ( https://img.shields.io/github/repo-size/scriptex/html5-form-validator?style=plastic )
28
+ ![ GitHub language count] ( https://img.shields.io/github/languages/count/scriptex/html5-form-validator?style=plastic )
29
+ ![ GitHub top language] ( https://img.shields.io/github/languages/top/scriptex/html5-form-validator?style=plastic )
30
+ ![ GitHub last commit] ( https://img.shields.io/github/last-commit/scriptex/html5-form-validator?style=plastic )
13
31
14
32
## Install
15
33
23
41
yarn add html5-form-validator
24
42
```
25
43
26
- or
27
-
28
- just download this repository and link the files located in dist folder
29
-
30
- or include it from unpkg.com
31
-
32
- ``` html
33
- <script src =" https://unpkg.com/html5-form-validator" ></script >
34
- ```
35
-
36
44
## Usage
37
45
38
46
``` javascript
39
- import ' html5-form-validator' ;
47
+ import { HTML5FormValidation } from ' html5-form-validator' ;
40
48
```
41
49
42
50
Then initialize with default settings:
43
51
44
52
``` javascript
45
- new html5formValidation ();
53
+ new HTML5FormValidation ();
46
54
```
47
55
48
56
or supply your own
49
57
50
58
``` javascript
51
59
const form = document .querySelector (' #form' );
52
60
53
- new html5formValidation (form, {
61
+ new HTML5FormValidation (form, {
54
62
errorElement: ' form__error' ,
55
63
invalidClass: ' is--invalid' ,
56
64
submitHandler (instance ) {
@@ -62,20 +70,107 @@ new html5formValidation(form, {
62
70
63
71
## Options
64
72
65
- ` errorElement ` - The classname of the element that will be added to the dom after the required field. Defaults to ` error ` .
66
-
67
- ` invalidClass ` - The classname of the required field when it is invalid. Defaults to ` invalid ` .
68
-
69
- ` submitHandler ` - A function to run on valid form submission. Accepts a single ` instance ` argument which refers to the constuctor's instance. Defaults to ` null ` .
70
-
71
- ` validateOnInput ` - Set to false if you want to show visual feedback for invalid fields after the first invalid submission. Defaults to ` true ` .
72
-
73
- ## Support this project
74
-
75
- [ ![ Tweet] ( https://img.shields.io/badge/Tweet-Share_this_repository-blue.svg?style=flat-square&logo=twitter&color=38A1F3 )] ( https://twitter.com/intent/tweet?text=Checkout%20this%20awesome%20software%20project%3A&url=https%3A%2F%2Fgithub.com%2Fscriptex%2Fhtml5-form-validator&via=scriptexbg&hashtags=software%2Cgithub%2Ccode%2Cawesome )
76
- [ ![ Donate] ( https://img.shields.io/badge/Donate-Support_me_on_PayPal-blue.svg?style=flat-square&logo=paypal&color=222d65 )] ( https://www.paypal.me/scriptex )
77
- [ ![ Become a Patron] ( https://img.shields.io/badge/Become_Patron-Support_me_on_Patreon-blue.svg?style=flat-square&logo=patreon&color=e64413 )] ( https://www.patreon.com/atanas )
73
+ | Option | Type | Required | Default | Description |
74
+ | ----------------- | ---------- | -------- | ----------- | --------------------------------------------------------------------------------------------------- |
75
+ | ` errorElement ` | ` string ` | false | ` 'error' ` | The class name of the element that will be added to the DOM after the required field. |
76
+ | ` invalidClass ` | ` string ` | false | ` 'invalid' ` | The classname of the required field when it is invalid |
77
+ | ` submitHandler ` | ` Function ` | false | ` null ` | A function to run on form submission. Accepts a single argument - the HTML5FormValidation instance. |
78
+ | ` validateOnInput ` | ` boolean ` | false | ` true ` | Validate as you type. Set to ` false ` to validate only on submit. |
78
79
79
80
## LICENSE
80
81
81
82
MIT
83
+
84
+ ---
85
+
86
+ <div align =" center " >
87
+ Connect with me:
88
+ </div >
89
+
90
+ <br />
91
+
92
+ <div align =" center " >
93
+ <a href="https://atanas.info">
94
+ <img src="https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/logo.svg" height="20" alt="">
95
+ </a>
96
+
97
+ <a href="mailto:[email protected] ">
98
+ <img src="https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/email.svg" height="20" alt="">
99
+ </a>
100
+
101
+ <a href="https://www.linkedin.com/in/scriptex/">
102
+ <img src="https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/linkedin.svg" height="20" alt="">
103
+ </a>
104
+
105
+ <a href="https://github.com/scriptex">
106
+ <img src="https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/github.svg" height="20" alt="">
107
+ </a>
108
+
109
+ <a href="https://gitlab.com/scriptex">
110
+ <img src="https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/gitlab.svg" height="20" alt="">
111
+ </a>
112
+
113
+ <a href="https://twitter.com/scriptexbg">
114
+ <img src="https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/twitter.svg" height="20" alt="">
115
+ </a>
116
+
117
+ <a href="https://www.npmjs.com/~scriptex">
118
+ <img src="https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/npm.svg" height="20" alt="">
119
+ </a>
120
+
121
+ <a href="https://www.youtube.com/user/scriptex">
122
+ <img src="https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/youtube.svg" height="20" alt="">
123
+ </a>
124
+
125
+ <a href="https://stackoverflow.com/users/4140082/atanas-atanasov">
126
+ <img src="https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/stackoverflow.svg" height="20" alt="">
127
+ </a>
128
+
129
+ <a href="https://codepen.io/scriptex/">
130
+ <img src="https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/codepen.svg" width="20" alt="">
131
+ </a>
132
+
133
+ <a href="https://profile.codersrank.io/user/scriptex">
134
+ <img src="https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/codersrank.svg" height="20" alt="">
135
+ </a>
136
+
137
+ <a href="https://linktr.ee/scriptex">
138
+ <img src="https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/linktree.svg" height="20" alt="">
139
+ </a>
140
+ </div >
141
+
142
+ ---
143
+
144
+ <div align =" center " >
145
+ Support and sponsor my work:
146
+ <br />
147
+ <br />
148
+ <a href =" https://twitter.com/intent/tweet?text=Checkout%20this%20awesome%20developer%20profile%3A&url=https%3A%2F%2Fgithub.com%2Fscriptex&via=scriptexbg&hashtags=software%2Cgithub%2Ccode%2Cawesome " title =" Tweet " >
149
+ <img src="https://img.shields.io/badge/Tweet-Share_my_profile-blue.svg?logo=twitter&color=38A1F3" />
150
+ </a >
151
+ <a href =" https://paypal.me/scriptex " title =" Donate on Paypal " >
152
+ <img src="https://img.shields.io/badge/Donate-Support_me_on_PayPal-blue.svg?logo=paypal&color=222d65" />
153
+ </a >
154
+ <a href =" https://revolut.me/scriptex " title =" Donate on Revolut " >
155
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/scriptex/scriptex/master/badges/revolut.json" />
156
+ </a >
157
+ <a href =" https://patreon.com/atanas " title =" Become a Patron " >
158
+ <img src="https://img.shields.io/badge/Become_Patron-Support_me_on_Patreon-blue.svg?logo=patreon&color=e64413" />
159
+ </a >
160
+ <a href =" https://ko-fi.com/scriptex " title =" Buy Me A Coffee " >
161
+ <img src="https://img.shields.io/badge/Donate-Buy%20me%20a%20coffee-yellow.svg?logo=ko-fi" />
162
+ </a >
163
+ <a href =" https://liberapay.com/scriptex/donate " title =" Donate on Liberapay " >
164
+ <img src="https://img.shields.io/liberapay/receives/scriptex?label=Donate%20on%20Liberapay&logo=liberapay" />
165
+ </a >
166
+
167
+ <a href =" https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/scriptex/scriptex/master/badges/bitcoin.json " title =" Donate Bitcoin " >
168
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/scriptex/scriptex/master/badges/bitcoin.json" />
169
+ </a >
170
+ <a href =" https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/scriptex/scriptex/master/badges/etherium.json " title =" Donate Etherium " >
171
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/scriptex/scriptex/master/badges/etherium.json" />
172
+ </a >
173
+ <a href =" https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/scriptex/scriptex/master/badges/shiba-inu.json " title =" Donate Shiba Inu " >
174
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/scriptex/scriptex/master/badges/shiba-inu.json" />
175
+ </a >
176
+ </div >
0 commit comments