diff options
Diffstat (limited to 'client/src/app/shared/shared-forms/form-validator.service.ts')
-rw-r--r-- | client/src/app/shared/shared-forms/form-validator.service.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/client/src/app/shared/shared-forms/form-validator.service.ts b/client/src/app/shared/shared-forms/form-validator.service.ts index c0664de5f..055fbb2d9 100644 --- a/client/src/app/shared/shared-forms/form-validator.service.ts +++ b/client/src/app/shared/shared-forms/form-validator.service.ts | |||
@@ -40,7 +40,7 @@ export class FormValidatorService { | |||
40 | return { form, formErrors, validationMessages } | 40 | return { form, formErrors, validationMessages } |
41 | } | 41 | } |
42 | 42 | ||
43 | updateForm ( | 43 | updateFormGroup ( |
44 | form: FormGroup, | 44 | form: FormGroup, |
45 | formErrors: FormReactiveErrors, | 45 | formErrors: FormReactiveErrors, |
46 | validationMessages: FormReactiveValidationMessages, | 46 | validationMessages: FormReactiveValidationMessages, |
@@ -52,7 +52,7 @@ export class FormValidatorService { | |||
52 | 52 | ||
53 | const field = obj[name] | 53 | const field = obj[name] |
54 | if (this.isRecursiveField(field)) { | 54 | if (this.isRecursiveField(field)) { |
55 | this.updateForm( | 55 | this.updateFormGroup( |
56 | form[name], | 56 | form[name], |
57 | formErrors[name] as FormReactiveErrors, | 57 | formErrors[name] as FormReactiveErrors, |
58 | validationMessages[name] as FormReactiveValidationMessages, | 58 | validationMessages[name] as FormReactiveValidationMessages, |
@@ -66,8 +66,10 @@ export class FormValidatorService { | |||
66 | 66 | ||
67 | const defaultValue = defaultValues[name] || '' | 67 | const defaultValue = defaultValues[name] || '' |
68 | 68 | ||
69 | if (field?.VALIDATORS) form.addControl(name, new FormControl(defaultValue, field.VALIDATORS as ValidatorFn[])) | 69 | form.addControl( |
70 | else form.addControl(name, new FormControl(defaultValue)) | 70 | name, |
71 | new FormControl(defaultValue, field?.VALIDATORS as ValidatorFn[]) | ||
72 | ) | ||
71 | } | 73 | } |
72 | } | 74 | } |
73 | 75 | ||