Skip to content

Commit

Permalink
Merge pull request #736 from MadhuMosip/develop
Browse files Browse the repository at this point in the history
MOSIP-32777 resolved name field accepting numbers issue
  • Loading branch information
aranaravi authored Jul 17, 2024
2 parents 8d37582 + 04b4753 commit c7da390
Showing 1 changed file with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -626,28 +626,33 @@ export class UpdatedemographicComponent implements OnInit, OnDestroy {
})
} else {
if (formControlName !== "proofOfIdentity") {
if (userNewData.toLowerCase() !== currentValue.toLowerCase() && /^[A-Za-z]+$/.test(userNewData) && userNewData !== this.userInputValues[formControlName][language] ) {
if (userNewData.toLowerCase() !== currentValue.toLowerCase() && /^[A-Za-z]+(\s[A-Za-z]+)*$/.test(userNewData) && userNewData !== this.userInputValues[formControlName][language]) {
this.isSameData[formControlName] = false;
this.enteredOnlyNumbers = false;
this.userInfoClone[formControlName] = []
if(!this.userInfoClone[formControlName])
this.userInfoClone[formControlName] = [];
this.getUserPerfLang.forEach(item => {
let newData
if (item === language) {
newData = { "language": language, "value": userNewData }
this.userInfoClone[formControlName].push(newData)
if(this.firstInputLang[formControlName] === language){
newData = { "language": language, "value": userNewData }
this.userInfoClone[formControlName].push(newData)
}else{
this.userInfoClone[formControlName].forEach(item =>{
if(item.language === language)
item.value = userNewData
})
}
this.userInputValues[formControlName][language] = userNewData;
} else {
if(this.firstInputLang[formControlName] === language)
this.translateUserInput(item, language, userNewData, formControlName, 'userInfoClone')
}
})
} else {
if (this.userInfoClone[formControlName]) {
delete this.userInfoClone[formControlName]
}
if(userNewData.toLowerCase() === currentValue.toLowerCase()){
this.isSameData[formControlName] = true;
}else if(!/^[A-Za-z]+$/.test(userNewData)){
}else if(!/^[A-Za-z]+(\s[A-Za-z]+)*$/.test(userNewData)){
this.enteredOnlyNumbers = true;
}

Expand Down Expand Up @@ -718,8 +723,8 @@ export class UpdatedemographicComponent implements OnInit, OnDestroy {
let self = this;
let userNewData = event.target.value.trim();
if (userNewData === "") {
if (this.userInfoClone[formControlName]) {
delete this.userInfoClone[formControlName]
if (this.userInfoAddressClone[formControlName]) {
delete this.userInfoAddressClone[formControlName]
}
this.getUserPerfLang.forEach(item => {
this.userInputValues[formControlName][item] = ''
Expand All @@ -728,12 +733,20 @@ export class UpdatedemographicComponent implements OnInit, OnDestroy {
if (formControlName !== "proofOfAddress") {
if (userNewData.toLowerCase() !== currentValue.toLowerCase()) {
this.isSameData[formControlName] = false;
this.userInfoAddressClone[formControlName] = []
if(!this.userInfoAddressClone[formControlName])
this.userInfoAddressClone[formControlName] = [];
this.getUserPerfLang.forEach(item => {
let newData
if (item === language) {
newData = { "language": language, "value": userNewData }
this.userInfoAddressClone[formControlName].push(newData)
if(this.firstInputLang[formControlName] === language){
newData = { "language": language, "value": userNewData }
this.userInfoAddressClone[formControlName].push(newData)
}else{
this.userInfoAddressClone[formControlName].forEach(item =>{
if(item.language === language)
item.value = userNewData
})
}
this.userInputValues[formControlName][language] = userNewData;
} else {
if(this.firstInputLang[formControlName] === language)
Expand Down

0 comments on commit c7da390

Please sign in to comment.