X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fforms%2Fform-reactive.ts;h=a5732e083a647422335ae176a797477e7257acbb;hb=3758da9489b636997a3a4fad7fc1a6081737bbe0;hp=1e8a69771c5ffe37d563a665cb8fa026e6c38185;hpb=4b2f33f3c6d109365090b08244d7f99ad4e69025;p=github%2FChocobozzz%2FPeerTube.git 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 { } } } + + // Same as onValueChanged but force checking even if the field is not dirty + protected forceCheck() { + for (const field in this.formErrors) { + // clear previous error message (if any) + this.formErrors[field] = ''; + const control = this.form.get(field); + + if (control && !control.valid) { + const messages = this.validationMessages[field]; + for (const key in control.errors) { + this.formErrors[field] += messages[key] + ' '; + } + } + } + } }