Understanding the Multiple-Selection List Box in InfoPath

Filed under: InfoPath 2007

Learn how multiple-selection list boxes differ from other list boxes in InfoPath, how they store data, and how you can use this information to apply rules and conditional formatting, or to write code in InfoPath.


The Multiple-Selection or Multi-Select List Box is a list box control that is new in InfoPath 2007. It is available for forms that are filled out through the InfoPath client application, but not through a browser. The latter should be available in InfoPath 2010 as the InfoPath Team recently announced.

While a multi-select list box has a lot in common with other list controls in InfoPath, it differs in how it stores its data.

A multi-select list stores selected items as a repeating field. The best way to see this is by viewing the node for the multi-select list box in the Data Source of an InfoPath form template as shown in the following figure.

A multiple-selection list box as shown in the data source of an InfoPath form template
Figure 1. A multiple-selection list box as shown in the data source of an InfoPath form template.

In addition, if you manually add a few entries to the list control, preview the InfoPath form, save it locally on disk, and then open it in Notepad, you would see similar contents as shown in the following figure.

Data stored by a multi-select list box in InfoPath 2007
Figure 2. Data stored by a multiple-selection list box in InfoPath 2007.

Note: In the figure above, I removed the InfoPath processing instructions for clarity. In addition, the multi-select list box had 3 items that could be selected (1, 2, and 3), and I selected only items 1 and 3.

As you can see from Figure 2, a multi-select list box stores the items that were selected as several fields under one group node; and not as one field. What this means is:

  1. If you use Rules to set the value of a multi-select list box, you can only set the value of, and thus select, one item at a time; not several.
  2. If you want to select several items in a multi-select list box all at once, you must use code to add several repeating nodes with the values that should be selected; you cannot use Rules to get this done.

So now that you know the basics of multiple-selection list boxes in InfoPath, you can also do neat things such as use conditional formatting to show or hide sections based on the selections in a multi-select list.

This question was asked recently in the InfoPath newsgroup, and since the steps to achieve it are not obvious and/or easy to perform, I went ahead and created a video on how to do this using a SharePoint list as the source for the multi-select list box and for a repeating section. In this InfoPath video tutorial, I also reveal a little trick I use to construct formulas when using a The expression condition in InfoPath.


Related Posts


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.