7

I need a generic validation for first and last name field that will be used everywhere. Currently I'm using:

/^[A-Za-z]?[A-Za-z ]*$/

21

Yes you should!

Your suggestion about having a validation rule would be a very bad idea. Did you know, the world's most common last name is 王?

Here is a classic article that you need to read: http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/

All of these assumptions are wrong:

  • (...)

  • People’s names are written in ASCII.

  • (...)

  • People’s names do not contain numbers.

  • (...)

| improve this answer | |
-1

I'm not sure regarding the code your using but I think if you'll have a small guidelines tooltip that will state that says not to use special characters in the first and last name that will be a nice UX , though i dont know what the application your using .. and not sure how you will apply it there ..(this forum has a tooltip like that for the password type here I found that very usfull)

| improve this answer | |
  • 2
    People's names do contain special characters. – Bart Gijssens Jul 25 '14 at 8:53
  • 2
    Yeah, I don't think I would find it a Good User Experience to be told I couldn't use characters that are in my name when inputting my name. – JonW Jul 25 '14 at 8:53
  • 1
    @JonW correct. Same with length restrictions, I've seen a screenshot of poor Mr. "Li" that couldn't get past the "minimum 3 characters" barrier – msp Jul 25 '14 at 9:21
  • 1
    @jonW true, you're right I thought you might be referring to sign like that .. @%^ in a user name .. so you are right! – J_pech Jul 25 '14 at 9:47
  • Unless you are attempting to enforce legal requirements on names in a particular jurisdiction, what purpose could you have in restricting what people are allowed to call themselves? – tripleee Nov 15 '17 at 5:34

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