138
138
> showSuccessLabels</ a
139
139
>
140
140
</ li >
141
+ < li class ="nav-item ">
142
+ < a class ="nav-link scrollto " href ="#section-5-13 "
143
+ > setCurrentLocale</ a
144
+ >
145
+ </ li >
141
146
< li class ="nav-item section-title mt-3 ">
142
147
< a class ="nav-link scrollto " href ="#section-6 "> Rules</ a >
143
148
</ li >
@@ -231,7 +236,7 @@ <h2>yarn</h2>
231
236
< header class ="docs-header ">
232
237
< h1 class ="docs-heading ">
233
238
Quick start
234
- < span class ="docs-time "> Last updated: 2022-03-16 </ span >
239
+ < span class ="docs-time "> Last updated: 2022-12-10 </ span >
235
240
</ h1 >
236
241
</ header >
237
242
< section class ="docs-intro ">
@@ -292,6 +297,23 @@ <h1 class="docs-heading">
292
297
rule: 'email',
293
298
errorMessage: 'Email is invalid!',
294
299
},
300
+ ]);</ code > </ pre >
301
+ < br />
302
+ Also it is possible to use a DOM element as a field in the
303
+ < code > .addField()</ code > method.
304
+
305
+ < pre > < code class ="language-javascript ">
306
+ validation
307
+ .addField(document.querySelector('#email'), [
308
+ {
309
+ rule: 'minLength',
310
+ value: 3,
311
+ },
312
+ {
313
+ rule: 'maxLength',
314
+ value: 30,
315
+ },
316
+ ])
295
317
]);</ code > </ pre >
296
318
And that's it! Now our form is validated!
297
319
</ section >
@@ -734,15 +756,15 @@ <h1 class="docs-heading">
734
756
< header class ="docs-header ">
735
757
< h1 class ="docs-heading ">
736
758
Methods
737
- < span class ="docs-time "> Last updated: 2022-05-18 </ span >
759
+ < span class ="docs-time "> Last updated: 2022-12-09 </ span >
738
760
</ h1 >
739
761
</ header >
740
762
< section class ="docs-section " id ="section-5-1 ">
741
763
< h2 class ="section-heading "> addField</ h2 >
742
764
< p > Defines validation rules for the new field.</ p >
743
765
744
766
< pre > < code class ="language-html "> .addField(< br />
745
- field: string,< br />
767
+ field: string | HTMLInputElement ,< br />
746
768
rules: {< br />
747
769
rule?: Rules;< br />
748
770
errorMessage?: string | (< br />
@@ -1021,7 +1043,7 @@ <h2 class="section-heading">revalidateField</h2>
1021
1043
Method to trigger a field validation manually. Returns a promise
1022
1044
with a boolean value - valid/invalid field.
1023
1045
</ p >
1024
- < pre > < code class ="language-html "> .revalidateField(field: string).then(isValid => {})</ code > </ pre >
1046
+ < pre > < code class ="language-html "> .revalidateField(field: string | HTMLInputElement ).then(isValid => {})</ code > </ pre >
1025
1047
</ section >
1026
1048
< section class ="docs-section " id ="section-5-6 ">
1027
1049
< h2 class ="section-heading "> revalidate</ h2 >
@@ -1053,7 +1075,7 @@ <h2 class="section-heading">removeField</h2>
1053
1075
Method to remove validation rules/events/errors from the
1054
1076
particular field
1055
1077
</ p >
1056
- < pre > < code class ="language-html "> .removeField(field: string)</ code > </ pre >
1078
+ < pre > < code class ="language-html "> .removeField(field: string | HTMLInputElement )</ code > </ pre >
1057
1079
</ section >
1058
1080
< section class ="docs-section " id ="section-5-10 ">
1059
1081
< h2 class ="section-heading "> removeGroup</ h2 >
@@ -1077,6 +1099,13 @@ <h2 class="section-heading">showSuccessLabels</h2>
1077
1099
< p > For example:</ p >
1078
1100
< pre > < code class ="language-html "> .showSuccessLabels({ '#email': 'The email looks good!' })</ code > </ pre >
1079
1101
</ section >
1102
+ < section class ="docs-section " id ="section-5-13 ">
1103
+ < h2 class ="section-heading "> setCurrentLocale</ h2 >
1104
+ < p > Method to change current locale</ p >
1105
+ < pre > < code class ="language-html "> .setCurrentLocale(locale?: string)</ code > </ pre >
1106
+ < p > For example:</ p >
1107
+ < pre > < code class ="language-html "> .setCurrentLocale('es')</ code > </ pre >
1108
+ </ section >
1080
1109
1081
1110
<!--//section-->
1082
1111
</ article >
0 commit comments