Hello,
I need to modify the value of a form control on blur, before the validation executes. Both the validation and the input manipulation must happen after the input is blurred. Right now, I tried to execute the manipulate function when blur event happens, but it does not work.
Example, what should happen:
- input has the value:
example.com, - on blur, the value is set to
123 - validation starts
Is this achievable, or would I need to explicitly call the validation after the manipulation happens?
this.linkForm = new FormGroup({
[NewLinkFields.destinationUrl]: new FormControl(null, {
validators: [LinkValidator.isValidUrl],
updateOn: 'blur',
}),
manipulate() {
this.linkForm.get(NewLinkFields.destinationUrl)?.setValue('somevalue');
this.linkForm.get(NewLinkFields.destinationUrl)?.updateValueAndValidity();
}