22div.vue-form-generator ( v-if ='schema != null' ) 
33fieldset( v-if ="schema.fields" , :is ='tag' ) 
44template( v-for ='field in fields' ) 
5- form-group( v-if ='isVisible(field)' , :vfg ="vfg" , :field ="field" , :errors ="errors" , :model ="model" , :options ="options" , @validated ="onFieldValidated" , @model-updated ="onModelUpdated" ) 
5+ form-group( v-if ='isVisible(field)' , :vfg ="vfg" , :field ="field" , :errors ="errors" , :model ="model" , :options ="options" , @blur  = "onBlur" ,  @ validated"onFieldValidated" , @model-updated ="onModelUpdated" ) 
66
77template( v-for ='group in groups' ) 
88fieldset( v-if ='isVisible(group)' , :is ='tag' , :class ='getFieldRowClasses(group)' ) 
99legend( v-if ='group.legend' )  {{ group.legend }}
1010template( v-for ='field in group.fields' ) 
11- form-group( v-if ='isVisible(field)' , :vfg ="vfg" , :field ="field" , :errors ="errors" , :model ="model" , :options ="options" , @validated ="onFieldValidated" , @model-updated ="onModelUpdated" ) 
11+ form-group( v-if ='isVisible(field)' , :vfg ="vfg" , :field ="field" , :errors ="errors" , :model ="model" , :options ="options" , @blur  = "onBlur" ,  @ validated"onFieldValidated" , @model-updated ="onModelUpdated" ) 
1212</template >
1313
1414<script >
@@ -130,6 +130,12 @@ export default {
130130}, 
131131
132132methods:  { 
133+ onBlur (value , model ) {
134+ if (objGet (this .options , " validateAfterBlur" false )) {
135+ this .validateModelField (model)
136+ } 
137+ }, 
138+ 
133139//  Get visible prop of field/group
134140isVisible (option ) {
135141if  (isFunction (option .visible )) return  option .visible .call (this , this .model , option, this );
@@ -139,15 +145,21 @@ export default {
139145return  option .visible ;
140146}, 
141147
148+ 
142149//  Validating one or more model properties
143150validateModelField (model ) {
144- this .clearValidationErrors ();
145- 
146151forEach (this .$children , child  =>  {
147152if  (isFunction (child .validate )) {
148153if  (model .includes (child .field .model )) {
149154child .validate (true ).then (function  (error ) {
150155if  (error[0 ]) {
156+ //  Remove old child errors
157+ Object .keys (this .errors )
158+ .filter ((key ) =>  { 
159+ return  this .errors [key].field .model  ===  child .field .model 
160+ }) 
161+ .forEach (key  =>  delete  this .errors [key]); 
162+ 
151163this .errors .push ({
152164field:  child .field , 
153165error:  error[0 ] 
0 commit comments