You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import { FormControl } from '@angular/forms';
export function matchingPasswords(control: FormControl): {[s: string]: boolean} {
const password = control.get('password');
const confirmPassword = control.get('passwordRetype');
if (password.value !== confirmPassword.value) {
console.log('passwords do NOT match');
return {
'noMatchingPasswords': true
};
} else {
console.log('passwords match');
return null;
}
}
The validation is working great so far and I am not able to save the form without matching passwords. However, any validation fail on inner fields (password fields) leads to an empty errorMessage on the formGroup. The use case for this error is: I am typing in less than 8 characters in both password fields, but both fields are matching. Hence, the custom validation succeeds. This results in an empty error box displayed for the form.
What do I have to do, to get rid of this error box, or alternatively: display the inner error?
Thanks in advance and have a great day!
The text was updated successfully, but these errors were encountered:
Hi there,
I am running into problems using custom validators on a DynamicFormGroupModel. I am using the following construct:
My validator is the following:
The validation is working great so far and I am not able to save the form without matching passwords. However, any validation fail on inner fields (password fields) leads to an empty errorMessage on the formGroup. The use case for this error is: I am typing in less than 8 characters in both password fields, but both fields are matching. Hence, the custom validation succeeds. This results in an empty error box displayed for the form.
What do I have to do, to get rid of this error box, or alternatively: display the inner error?
Thanks in advance and have a great day!
The text was updated successfully, but these errors were encountered: