Applies ToInfoPath 2010 InfoPath 2013

In this article

What is conditional formatting?

In Microsoft Office InfoPath 2007, conditional formatting allows you to specify different formatting options for a control, 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 displayed. You can use conditional formatting to apply bold, underline, italic, strikethrough, font color, and background color to controls. You can also use conditional formatting to determine whether a control is visible on the form when users fill it out, whether the control is disabled, or whether to enable users to add or remove certain controls, such as optional sections.

The following includes some examples of how to use conditional formatting in a form template:

  • Hide the shipping address section unless the Specify Shipping Address check box is selected.

  • Change the font color to blue and the font style to bold for all expenses that require a receipt.

  • Change row colors in a repeating table based on the value of a text box in the row. For example, make the row for an item that is behind schedule red, and the row for an item that is on schedule green.

  • Mark financial entries with red text when they are less than $0 and green text when they are $0 or more.

  • Filter rows in a repeating table.

Note: To display a message when a user enters incorrect values into a form, you can also use data validation.

Top of Page

Compatibility considerations

When you design a form template in InfoPath, you can choose a specific compatibility mode to design a browser-compatible form template. When a browser-compatible form template is published to a server running InfoPath Forms Services, and then browser-enabled, forms based on the form template can be viewed in a Web browser. When you design a browser-compatible form template, some controls are unavailable in the Controls task pane because they cannot be displayed in a Web browser.

List of controls that support conditional formatting

The following table lists the Office InfoPath 2007 controls that support conditional formatting, and whether they are available for browser-compatible form templates.

Controls that support conditional formatting

Available for browser-compatible form templates?

Button

Yes

Check box

Yes

Date picker

Yes

Drop-down list box

Yes

Expression box

Yes

File attachment

Yes

List box

Yes

Option button

Yes

Optional section

Yes

Repeating section

Yes

Repeating table

Yes

Rich text box

Yes

Section

Yes

Text box

Yes

Bulleted, numbered, or plain list

No

Choice section

No

Combo box

No

Horizontal repeating table

No

Ink picture

No

Master/Detail

No

Multiple-selection list box

No

Picture

No

Repeating recursive section

No

Vertical label

No

Top of Page

Add conditional formatting

  1. On the form template, select the control that you want to add conditional formatting to, and then click Conditional Formatting on the Format menu.

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

  3. In the If this condition is true boxes, enter the condition.

    Note: InfoPath verifies a condition by checking the value of the field to which the control is bound, not the control itself.

  4. To add additional conditions, click And, and then in the rightmost box under If this condition is true, do one of the following:

    • To apply the formatting only when both conditions are true, click and.

    • To apply the formatting when one or both of the conditions are true, click the arrow next to and, and then click or.

  5. Under Then apply this formatting, select the formatting that you want to apply for your condition or conditions, and then click OK.

    Note: If more than one specified condition is true, InfoPath applies only the formatting of the first true condition.

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

Top of Page

Change conditional formatting

  1. On the form template, select the control whose conditional formatting you want to change, and then click Conditional Formatting on the Format menu.

  2. In the Conditional Formatting dialog box, select the condition that you want to change, and then click Modify.

  3. In the If this condition is true boxes, modify the condition.

    Note: InfoPath verifies a condition by checking the value of the field that is bound to the control, not the control itself.

  4. Select any new formatting that you want to apply for your condition or conditions, and then click OK.

  5. If you have multiple conditions for a control and want to change the order in which they are evaluated, select a condition in the Conditional Formatting dialog box, and then click Move Up or Move Down.

    Note: If more than one specified condition is true, InfoPath applies only the formatting of the first true condition.

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

Top of Page

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.