Automatically change the first letter of a word/sentence to upper case

Applies to: InfoPath 2003

Use the concat(), substring(), translate(), and string-length() function within a formula to convert the first letter in a word or sentence.

ADVERTISEMENTS

Problem

When an InfoPath user types in the text "example" or "this is really cool!", you would like this text to automatically be changed into "Example" or "This is really cool!" when the user leaves the text field.

Solution

Use the concat(), substring(), translate(), and string-length() functions in a formula to format the text field.

Discussion

You can accomplish this functionality as follows:

  1. Create a New Blank Form in InfoPath.
  2. Add a Text Box control to the form.
  3. Double-click on the text box control to open its Properties dialog box.
  4. Click on the Insert Formula button behind the Default Value field.
  5. Enter the following formula on the Insert Formula dialog box:
    concat(substring(translate(., "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), 1, 1), substring(., 2, string-length(.) - 1))
  6. Click on the OK button when closing all open dialog boxes.

The first letter of a word or sentence typed into the text box should now automatically be converted into an upper case letter whenever the text box loses the focus.

 


Related InfoPath Articles:

 

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author.

InfoPath 2013 Cookbook: 121 Codeless Recipes for Beginners

InfoPath 2013 Cookbook 2: 121 Codeless Recipes for SharePoint 2013

InfoPath 2010 Cookbook: 101 Codeless Recipes for Beginners

InfoPath 2010 Cookbook 2: 101 Codeless Recipes for SharePoint 2010

InfoPath 2010 Cookbook 3: 101 Code Recipes for C# Developers

InfoPath 2010 Cookbook 4: 101 Code Recipes for VB Developers

InfoPath 2010 Cookbook 5: Integrating InfoPath with Excel and Excel Services