Currently, I am working with Angular and HTML. I have implemented pattern validation for the first name field, which should not accept only numbers.
<fieldset class="six">
<input id="firstName" ng-pattern="^[a-zA-Z]+$" type="text"
[(ngModel)]="user.firstName" formControlName="firstName"
required autocomplete="given-name" placeholder="First
name"/>
<label class="validation-message alert"
*ngIf="( (!newUserForm.controls.firstName
||user.firstName.trim().length == 0 ) &&
(newUserForm.controls.firstName.touched))">
First Name is required </label>
<label class="validation-message alert" *ngif="
newUserForm.firstName.touched " ng-message="
newUserForm.firstName.hasError('firstName')">
Invalid First Name </label>
</fieldset>
I am facing an issue where the invalid first name message always shows up. I would appreciate any assistance on resolving this problem. Thank you in advance!