Cognito Forms logo

How do I auto-capitalize a Name field?

Thursday, October 5, 2017 10:28:00 AM

To ensure that someone capitalizes the first letter of their first and last names:

  1. Select your Name field.
  2. Find the Show Custom Error - When option in the field settings, and set the following expression as the custom error: =(!Name.First.Substring(0, 1).Contains(Name.First.ToUpper().Substring(0, 1))) or (!Name.Last.Substring(0, 1).Contains(Name.Last.ToUpper().Substring(0, 1)))
  3. Write your custom error message ("Please capitalize the first letter of your first and last names.").

Printable View