Cognito Forms logo

How do I auto-capitalize a Name field?

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

To automatically capitalize the first letters of a first and last name:

  1. Add a Textbox field to your form labelled Name.
  2. Set the default value of the Textbox field to the following expression: 
    =(Name.Split(' ').Select(it.Substring(0,1).ToUpper() + it.Substring(1))+ "").Replace(", ", " ")
  3. When someone enters their name, the default expression will separate their first and last name by spaces to ensure that the first character of each name is capitalized.

Printable View