we have only one Input Filed for both Serial and References number entry. {so, 1st character can be A or 0-9, 2nd to 8th characters must be -> btw 0-9} serial: number requirement {0-9} - only 8 characters. references : number requirement - {only 1st character must be 'A'}- only 8 characters. No space, No special characters, no lower case aplha (a-z). No upper case Alpha (B-Z)
input filed contain small search icon too, when we enter number and click on search icon then only we are able to see the details. but the requirement is to - even we click enter/return from our keyboard and even we click search icon we should see the result. So , To accomplish I tried this -onInputKeydown(event: Keyboard Event)
to accomplish 2nd requirement (1st character should be A or 0-9, 2nd to 8th characters must be -> btw 0-9}) I'm trying validation Rules
after using validationRules -> able to get half result - (no spaces, no special characters)
but still need - 1st character to be only 'A' or 0-9. and 2nd to 8th characters must be only 0-9 numbers.
Can someone help me out please.
<input #input type="text" maxlength="8" pInputText [(ngModel)]="caseNumber" placeholder="Enter Reference or Serial #" (keydown)="onInputKeydown($event)" (keypress)="validationRules($event)" class="srnumber" />`
onInputKeydown(event: KeyboardEvent){
const key = event.which;
if (key === 13) {
this.docManagerService.getCaseMetadata(this.caseNumber);
}
}
validation Rules(event:KeyboardEvent){
const k = event.Keycode;
return((k > 64 && k < 91) || (k >= 48 && k <= 57));
}
}