Add containers and group controls

In a Microsoft Office InfoPath form template, you can add several different types of container, or group, controls to organize data on an InfoPath 2010 form. These controls can be used to logically group controls on a form or they can be used to perform actions on the controls as a group, such as hiding them.

In this article

About containers and layout controls

Insert a container control

Layout Tips

About containers and layout controls

Section

Section controls are, essentially, containers that enable you to organize related controls into groups in an InfoPath form template. For example, on an insurance claim form template, you can have one section for policy holder contact information, while placing claim limitations in another section.

You can also use rules to affect section controls, allowing you to show or hide them based on criteria in the form. For example, on an expense report form, you might use conditional formatting to show a manager approval section to users when their expenses total more than $1,000. If expenses are less than that, the section remains hidden on the form.

Use a section when you want to:

  • Bundle controls together into logical groups for organization

  • Show or hide groups of controls based on user input

Optional Section

Optional section controls are identical in functionality to the section control, except that the optional section control does not appear in the form, by default, when the user is filling it out. For example, on an insurance claim form template, you could have a section to allow the user to add additional comments if they want. Users can click the Click here to insert link to make the optional section control appear on the form.

Use an optional section control when you want to:

  • Give users the choice to include a section on their form that is not required. This is useful for status reports where you want to add supplementary notes sometimes, but leave them out at other times.

Scrolling Region

A scrolling region control works like a section, except that they are not compatible with web browser forms and you can define the height and width of the scrolling region control and it will scroll, as necessary, to enable the user to access all of its contents. By doing this, multiple controls can fit into a small area of a form, and the scrolling region control will not expand to take up more space than you specify. Scrolling regions are also not bound to any fields or groups in the Fields task pane.

Use a scrolling region control when you want to:

  • Add more controls to an area of your form template than would otherwise fit in a defined area.

Horizontal Region

The horizontal region control works like a section control, except that you can place multiple horizontal region controls on the same line and, if the form is resized, their contents will move to the next line, as needed. By doing this, you can lay out several groups of related controls, side-by-side, and they will dynamically take up as many lines as necessary, in order to fill the available space. This way, a user that is viewing the form on a wide monitor is able to see more of the form, while a user that is viewing the form on a narrow display will still be able to view all of the contents of the form by scrolling.

Note:  Horizontal repeating sections are also used to create horizontal tables, where columns are added instead of rows, as is often done in in Japanese and other Asian languages.

Use a horizontal region control when you want to:

  • Bundle controls together into different sections that can appear side-by-side or one on top of the other.

  • Show or hide one or more horizontal region controls based on specified criteria.

Choice Group

A choice group control allows you to present a set of mutually-exclusive sections to a user that they can choose between, or allow them to remove the choice group completely. For example, on a purchase request form, you can have a section for requesting a new desktop computer appear by default, but allow users to remove the section entirely or replace it with a section for requesting a laptop computer.

When users move their cursor over the default choice section, a small purple button appears in the upper-left corner of the section. When users click this button, a shortcut menu shows commands for removing or replacing the default section. By default, a choice group contains only two choice sections, one of which is the default choice on the form. If you want to enable a user to select from additional sections, however, then add additional choice section controls.

Use a choice group control when you want to:

  • Enable users to choose only one of several mutually-exclusive sections on a form.

Choice Section

The choice section control, which is found inside the choice group control, contains the controls that users interact with when they fill out a form. Choice section controls are always contained within choice groups. Because of this, if you try to add a choice section control by itself to your form template, Microsoft Office InfoPath will automatically create a choice group control to contain the choice section control.

Use a choice section control when you want to:

  • Add additional options to a choice group control.

Top of Page

Insert a container control

The procedure for inserting a container control differs slightly, depending on whether you are designing a new, blank form template or basing the design of your form template on a database or other external data source.

Insert a container control in a new, blank form template

  1. On the form template, place the cursor where you want to insert the container control.

  2. On the Home tab, in the Controls group, click the type of container control to insert.

    Add containers and group controls

  3. If inserting a choice group, add additional choice section controls by clicking where you want to insert them in the choice group and, on the Home tab, in the Controls group, click Choice Section.

    Note:  If adding a choice group control, because the shortcut menu button appears only when users move their pointer over the control, new users may not understand how to replace the default choice section. When designing the form template, consider adding a brief explanation above the choice section that tells users how to replace one choice section with another.

  4. To add a label to the container control, type text above or to the left of it. For example, if the container control contains fields related to information about the user of the form, you can type, User Information.

  5. Add controls to the container control, just like you would to the rest of the form, to arrange the controls.

Insert a container control on a form template that is based on an existing data source

If you base the design of your form template on an external data source, InfoPath retrieves the fields and groups in the Fields task pane from the external source. In this scenario, you can insert a container control by dragging a group from the Fields task pane onto the form or by inserting a control group, as described in the following procedure:

  1. On the form template, place the cursor where you want to insert the container control.

  2. Right-click on the appropriate group from the external data source in the Fields task pane.

  3. Select the type of container control to insert that is compatible with the data type.

    Note:  If adding a choice group control, because the shortcut menu button appears only when users move their pointer over the control, new users may not understand how to replace the default choice section. When designing the form template, consider adding a brief explanation above the choice section that tells users how to replace one choice section with another.

  4. InfoPath uses the name of the field or group as the control's label. If necessary, change the label text.

Tip:  You can also drag the group from the Fields task pane to the form. If you do this, InfoPath will choose the most appropriate control group based on the group type. If the correct type is not selected by default, use the previous method to select the correct type.

Note:  You cannot add scrolling region or horizontal region controls to your form this way as they are not bound to fields or groups, and, as a result, are not represented in the Fields task pane.

Top of Page

Layout Tips

Use the following tips to help you refine the appearance, size, and other aspects of the container controls:

  • To change the border or background color of a container control, select it on the form template, and then, under Control Tools, on the Properties tab, in the Color group, select either Shading or Borders, and make the necessary adjustments.

Add containers and group controls

Note:  You cannot apply a border or shading to a choice group control. You must apply these properties to the appropriate choice section control inside the choice group control.

  • To change the width of several container controls at once, select the desired controls then, under Control Tools, on the Properties tab, in the Control Size group, in the Width box, enter the desired width, and then press ENTER on the keyboard.

  • To refine the spacing either in or around a container control, change the padding, which is the amount of buffer space between the border of the container control and the contents, or change the margin, which is the amount of space between the container control and its surroundings. To adjust the spacing, select the control then, under Control Tools, on the Properties tab, in the Properties group, click Control Properties. Click the Size tab, and then adjust the padding and/or margins as appropriate.

Add containers and group controls

Control container and group design considerations

Before you insert controls onto a container control, think about how you want to arrange those controls. You can add text boxes and other controls by dragging them into the section wherever you want. Or if you want more control over the layout, you can add a layout table inside the container control and then insert labels and controls inside the individual cells so that they align nicely. In the following example, the form designer has added a two column, three row layout table to control the layout of the controls inside the section.

Add containers and group controls

Hide a container or group control based on values in the form

While there are many rules that you can use to control the status of a container control, one of the common uses of a container control is to hide the contents, based on a value in the form.

For instructions regarding how to add this type of rule, see Add formatting rules.

For instructions regarding other types of rules that you can use, see Introduction to rules.

Top of Page

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!

×