aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/forms/form-reactive.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/forms/form-reactive.ts')
-rw-r--r--client/src/app/shared/forms/form-reactive.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/client/src/app/shared/forms/form-reactive.ts b/client/src/app/shared/forms/form-reactive.ts
index 1e8a69771..a5732e083 100644
--- a/client/src/app/shared/forms/form-reactive.ts
+++ b/client/src/app/shared/forms/form-reactive.ts
@@ -21,4 +21,20 @@ export abstract class FormReactive {
21 } 21 }
22 } 22 }
23 } 23 }
24
25 // Same as onValueChanged but force checking even if the field is not dirty
26 protected forceCheck() {
27 for (const field in this.formErrors) {
28 // clear previous error message (if any)
29 this.formErrors[field] = '';
30 const control = this.form.get(field);
31
32 if (control && !control.valid) {
33 const messages = this.validationMessages[field];
34 for (const key in control.errors) {
35 this.formErrors[field] += messages[key] + ' ';
36 }
37 }
38 }
39 }
24} 40}