InfoPath 2010 – Automatically set first letter in name to uppercase

Requirement

You want to set the first letter in a field to uppercase, this is usually the case for fields that contain a persons name, etc.

Solution

  1. Create a field called ‘Name’.
  2. Create a new action rule for the field and set it up as follows:
Condition: None
Rule Type: Action
Run these actions:
Set a field’s value: ‘Name’
Value: Click on FX and use the following formula.

concat(translate(substring(Name, 1, 1), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"),substring(Name,2,string-length(Name-1)))

Now, when a person enters ‘mary’ as a name, the form will automatically update to ‘Mary’ when they proceed to the next field.

Tags:

2 Responses to “InfoPath 2010 – Automatically set first letter in name to uppercase”

  1. Thom King February 29, 2012 at 4:57 am #

    Very useful, just have one correction to formula above (remove right parentheses after last instance of “Name”):

    concat(translate(substring(Name, 1, 1), “abcdefghijklmnopqrstuvwxyz”, “ABCDEFGHIJKLMNOPQRSTUVWXYZ”),substring(Name,2,string-length(Name-1)))

  2. couldsia May 3, 2013 at 10:13 pm #

    How do you convert first name and last name’s first letter to capital letter if they are being captured in the same field and a space in between?

Leave a Reply

%d bloggers like this: