Conditional Formatting

 < Day Day Up > 

One of the novel features of InfoPath form templates (at least, if your previous experience has been limited to HTML forms) is the capability of InfoPath forms to change their appearance in response to form events, or according to the values contained in fields in the data source. This visual adaptability in InfoPath is called conditional formatting .

Conditional formatting allows form designers to highlight certain parts of a view in response to choices made by a user , or to hide or reveal parts of a form in response to choices made by users when filling in a form. Conditional formatting is available on the following form controls:

  • Text Box

  • Rich Text Box

  • Section

  • Optional Section

  • Repeating Section

  • Repeating Table

Conditional formatting is not available on the following form controls:

  • Drop-Down List Box

  • List Box

  • Check Box

  • Option Button

  • Bulleted List

  • Numbered List

  • Plain List

You can position the form controls for which conditional formatting is not available inside form controls that do support conditional formatting, and thereby apply conditional formatting to them.

Specifying Conditional Formatting

If conditional formatting is available, it is always accessed in the same way: Right-click on the form control and select the formControlName Properties option at the bottom of the context menu. A Properties window opens. Select the Display tab, and click the Conditional Formatting button. This opens the Conditional Formatting window (see Figure 6.19).

Figure 6.19. The Conditional Formatting window.

graphics/06fig19.gif

If no conditional formatting has been applied to the form control, no conditions are listed. To apply a condition, click the Add button on the Conditional Formatting window.

The Conditional Format window opens (see Figure 6.20).

Figure 6.20. The Conditional Format window.

graphics/06fig20.gif

Specifying conditions depends on named fields. We will use the SimpleHR3.xsn form template from Chapter 4. Follow these steps:

  1. Choose a field in the left drop-down menu on the Conditional Format window (see Figure 6.21).

    Figure 6.21. Specifying a field.

    graphics/06fig21.gif

  2. Specify a comparison expression using the middle drop-down menu (see Figure 6.22).

    Figure 6.22. Specifying a comparison operator.

    graphics/06fig22.gif

  3. Using the right drop-down menu, specify the comparator for the field specified in the left drop-down menu (see Figure 6.23). The number and names of the options in the right drop-down menu vary depending on the data type of the field chosen in the left drop-down menu.

    Figure 6.23. Specifying the comparator.

    graphics/06fig23.gif

Thus, if you want to specify some conditional formatting if the value of the LastName field is Watt , you can make the choices shown in Figure 6.24 to create a conditional formatting rule.

Figure 6.24. A conditional formatting rule.

graphics/06fig24.gif

If you want to create only one conditional formatting rule, you can move on to specify what format is desired. If a second or subsequent rule is desired, click the Add button to the right of the three drop-down menus .

Types of Conditional Formatting

Several types of conditional formatting are available in InfoPath 2003. You can hide the form control completely by checking the Hide This Control check box. If you do so, the other options are grayed out.

Assuming the form control is to remain visible, you can change the background color (shading) of the form control and its font characteristics by making one or more selections from the Bold, Underline, Italic, and Strikethrough check boxes and the Font Color and Background Color drop-down menus.

 < Day Day Up > 


Microsoft Office InfoPath 2003 Kick Start
Microsoft Office InfoPath 2003 Kick Start
ISBN: 067232623X
EAN: 2147483647
Year: 2004
Pages: 206

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net