tl/dr: Only validate to make sure Firstname OR Lastname has been entered and make sure you set maxlength to over 800 characters!

Names. Every person on the planet has one or they at least have something by which they are known and distinguished from others. My last name has two uppercase characters but what you might not know is that this causes havoc with some companies websites where a rookie web dev has enforced some silly validation option on the customer name properties. Normally the validation forces the first letter to be a capital and every other letter to be lowercase. This is bad practice! If you have this validation on your site then you are alienating millions of people around the world who might use your service. Consider these names:

  • Elizabeth-Anastasia Saunders-Gallagher
    • Total: 38
    • Firstname: 19
    • Lastname: 18
    • Oddity: Double-barrelled-first-name-and-last-name
  • James O’Neill
    • Total: 13
    • Firstname: 5
    • Lastname: 7
    • Oddity: Apostrophe (Remember SQL injection!)
  • James-Dean Cortés
    • Total: 18
    • Firstname: 10
    • Lastname: 7
    • Oddity: Accented letter
  • Cher
    • Total: 4
    • Firstname: 4
    • Lastname: 0
    • Oddity: One-word name
  • X Æ A-12
    • Total: 9
    • Firstname: 1 ?
    • Lastname: 4 ?
    • Oddity: This famous name contains a non-ASCII character but that might be a middle name, I can’t find a definitive source on which part is which. This could all be firstname so that means it contains spaces too.

These are names that could easily appear in a native English-speaking country and yet all of these would be mangled by input forms on a lot of websites. In the above I use the word ‘oddity’ to point out something unusual about the name but as web developers you have to work beyond what you might find odd and consider your audience. Is your application likely to have non-English speakers sign up? If so you’ll definitely need to accommodate all accented characters and maybe even letters from very different alphabets (Cyrillic, Greek, Chinese, Arabic, Korean, Japanese, etc..)

The next time you make a sign-up form keep these examples in mind and you’d better make sure the maxlength is longer than 747 characters!

I’m aware of the irony in this post and the fact I choose to display my name in lowercase on this website’s header and title. On my site, I think lowercase looks better stylistically but if I’m dealing with any official entity it should be cased properly.