Skip to content

Commit

Permalink
Merge pull request #778 from MadhuMosip/develop
Browse files Browse the repository at this point in the history
MOSIP-34689 added regex validation for email and phone
  • Loading branch information
aranaravi authored Nov 4, 2024
2 parents d0136bd + 37e0c0a commit 1006606
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -989,9 +989,9 @@ <h3 [style.font-size]="fontSize.headingForUIN" class="tab-headings">{{'updatedem
<mat-card-subtitle [style.font-size]="fontSize.paragraph" class="contact-lable">{{field.labelName[langCode][1]}}</mat-card-subtitle>
<div class="search-input-card" *ngIf="field.attributeName === 'email'">
<input [style.font-size]="fontSize.paragraph" class="input" [value]="userIdEmail" matInput type="text" #{{field.attributeName}}
id="{{field.attributeName}}" (input)="captureContactValue($event, field.attributeName)"
id="{{field.attributeName}}" (input)="captureContactValue($event, field )"
[placeholder]="field.placeHolder[langCode]"
(blur)="captureContactValue($event, field.attributeName)"
(blur)="captureContactValue($event, field)"
(focus)="captureVirtualKeyboard(field.attributeName, buildJSONData[field.attributeName].index)"
(click)="isUpdatedataInProgress($event, 'textField')"
#keyboardRef />
Expand All @@ -1000,9 +1000,9 @@ <h3 [style.font-size]="fontSize.headingForUIN" class="tab-headings">{{'updatedem
</div>
<div class="search-input-card" *ngIf="field.attributeName === 'phone'">
<input [style.font-size]="fontSize.paragraph" class="input" [value]="userIdPhone" matInput type="text" #{{field.attributeName}}
id="{{field.attributeName}}" (input)="captureContactValue($event, field.attributeName)"
id="{{field.attributeName}}" (input)="captureContactValue($event, field)"
[placeholder]="field.placeHolder[langCode]"
(blur)="captureContactValue($event, field.attributeName)"
(blur)="captureContactValue($event, field)"
(focus)="captureVirtualKeyboard(field.attributeName, buildJSONData[field.attributeName].index)"
(click)="isUpdatedataInProgress($event, 'textField')"
#keyboardRef />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1006606

Please sign in to comment.