File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 18
18
// first check if we need to create a field
19
19
if ( ! this .form .$errors [this .field .key ] ) this .$set (this .form .$errors , this .field .key , {});
20
20
if ( ! this .field .templateOptions ) this .$set (this .field , ' templateOptions' , {});
21
-
21
+
22
22
// check for required fields. This whole setting,unsetting thing seems kind of wrong though..
23
23
// there might be a more 'vue-ey' way to do this...
24
24
if ( this .field .required ){
25
25
if ( ! this .form .$errors [this .field .key ].required ) this .$set (this .form .$errors [ this .field .key ], ' required' , true );
26
26
setError (this .form , this .field .key , ' required' , ! this .model [ this .field .key ]) ;
27
27
}
28
-
28
+
29
29
// if we've got nothing left then return
30
30
if ( ! this .field .validators ) return ;
31
31
35
35
36
36
Object .keys (this .field .validators ).forEach ((validKey ) => {
37
37
if ( ! this .form .$errors [this .field .key ][validKey] ) this .$set (this .form .$errors [ this .field .key ], validKey, false );
38
- if ( ! this .field .required && ! this .model [ this .field .key ] ) return ;
38
+ if ( ! this .field .required && ! this .model [ this .field .key ] ) {
39
+ setError (this .form , this .field .key , validKey, false );
40
+ return ;
41
+ }
39
42
40
43
let validator = this .field .validators [validKey];
41
44
let validatorMessage = false ;
You can’t perform that action at this time.
0 commit comments