Reputation: 511
First I've searched for the answer but with no success till now.
I have an form that submits some inputs via POST but before that I want to secure on client side that for the First Name and Last Name are used only Latin or Cyrillic letters.
So far it works only for the Latin letters but I cant get it work with Cyrillic letters. This is what I use now, any help would be appreciated
<input id="userfnamesignup" type="text" pattern="[a-zA-Z]{3-30}"
name="user_fname" placeholder="Enter your name please" required />
Upvotes: 1
Views: 2492
Reputation: 692
Update on the answer from Explosion Pills to accept whitespaces
pattern="[a-zA-Z\u0400-\u04ff\s]{3,30}"
Upvotes: 0
Reputation: 191779
JavaScript support for unicode is not great, but you should be able to use the Cyrillic unicode character range as part of the regex and it should work.
[a-zA-Z\u0400-\u04ff]{3,30}
Upvotes: 6