From 37e0c0a1b8c5bd2034f40b7863042c0a8d9c95dc Mon Sep 17 00:00:00 2001 From: MadhuMosip Date: Mon, 4 Nov 2024 15:39:57 +0530 Subject: [PATCH] MOSIP-34689 added regex validation for email and phone Signed-off-by: MadhuMosip --- .../updatedemographic/updatedemographic.component.html | 8 ++++---- .../updatedemographic/updatedemographic.component.ts | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.html b/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.html index 9046f056..918373c6 100644 --- a/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.html +++ b/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.html @@ -989,9 +989,9 @@

{{'updatedem {{field.labelName[langCode][1]}}
@@ -1000,9 +1000,9 @@

{{'updatedem

diff --git a/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.ts b/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.ts index 4223f97d..b34ea64f 100644 --- a/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.ts +++ b/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.ts @@ -790,14 +790,16 @@ export class UpdatedemographicComponent implements OnInit, OnDestroy { } captureContactValue(event: any, formControlName: any) { - if(event.target.value.length){ + this.userId = event.target.value.trim(); + this.contactTye = formControlName.attributeName; + + if(new RegExp(formControlName.validators[0].validator).test(this.userId)){ this.sendOtpDisable = false; }else{ this.sendOtpDisable = true; } - this.userId = event.target.value.trim(); - this.contactTye = formControlName; - if(formControlName === "email"){ + + if(formControlName.attributeName === "email"){ this.userIdEmail = this.userId }else{ this.userIdPhone = this.userId