I need help validating " First Name" input field. The validation is the field should not accept numbers and special characters. There is no button at this point . But message should pop as user tries to enter data with numbers and special characters.In other words it should only accept characters.

can someone send me the snipplet firstname validation


You just need to specify a pattern:

<lightning:input ... pattern="[a-zA-Z]*" 
                 messageWhenPatternMismatch="Please use only letters." />

If you're not familiar with regular expressions, you can read about them here (or other resources).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.