Use color to indicate status in a repeating section

In Microsoft Office InfoPath, you can use conditional formatting to specify different formatting options for a control that is based on conditions that occur on the form. If the specified conditions are true when a user fills out a form that is based on your form template, the conditional formatting is applied.

This article explains how to use conditional formatting to change the background color of a row in a repeating section. This is useful if you want to show the status of an item in the repeating section. For example, in a status report form template, you can use conditional formatting to make the row for an item that is behind schedule red, and the row for an item that is on schedule green.

Note: This article uses color to demonstrate a procedure. However, some users cannot discern colors. To create an accessible form template, be sure to also add meaningful text to your form template to indicate the status of an item.

In this article

Step 1: Add your controls

Step 2: Specify the conditional formatting

Step 3: Preview the form template

Step 1: Add your controls

In order to complete this procedure, your form template must contain a repeating section, a text box, and a drop-down list box. To add these controls, do the following:

  1. On the form template, click where you want to insert a repeating section.

  2. If the Controls task pane is not visible, click More Controls on the Insert menu, or press ALT+I, C.

  3. In the Controls task pane, select the Automatically create data source check box.

  4. Under Insert controls, click Repeating Section.

  5. Place the insertion point in the repeating section.

  6. Under Insert controls in the Controls task pane, click Text Box.

  7. Press ENTER, and then under Insert controls, click Drop-Down List Box.

  8. In the form template, type Work Item: as the label for the text box, and type Status: as the label for the drop-down list box.

  9. Double-click the drop-down list box on the form template.

  10. Click the Data tab.

  11. Under List box entries, click Add.

  12. In the Value box in the Add Choice dialog box, type Active, and then click OK.

  13. Repeat steps 11 and 12 to add Resolved and Closed as choices in the drop-down list box.

Top of Page

Step 2: Specify the conditional formatting

After you add your controls to the form template, you can specify the appropriate conditional formatting.

  1. Select the repeating section in the form template, and then on the Format menu, click Conditional Formatting.

  2. In the Conditional Formatting dialog box, click Add.

  3. Under If this condition is true, in the first box, click the field that corresponds to the drop-down list box that you just inserted.

  4. In the second box, leave the value as is equal to.

  5. In the third box, click Type text, and then type Active.

    Note: The expressions are case sensitive.

  6. In the Shading list under Then apply this formatting, click red, and then click OK.

  7. Repeat steps 2 through 6 to add conditional formatting for the two remaining list entries. Select yellow as the background color for Resolved and green as the background color for Closed.

Top of Page

Step 3: Preview the form template

After you add conditional formatting to the form template, it is recommended that you test the changes to make sure that they are working properly.

  1. To test your changes, click Preview on the Standard toolbar, or press CTRL+SHIFT+B.

  2. In the preview window, select the different options in the drop-down list. Notice that as you select the options, the background color in the section changes accordingly.

  3. On the Insert menu, point to Section, and then click the section name to add an additional section. Notice that the conditional formatting is applied independently to both sections.

Top of Page

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!