In this article

When to use a repeating section

A repeating section is a control that contains other controls and that repeats as needed. Use a repeating section when you want to:

Collect multiple instances of the same type of data. For example, on a sales report form template, you can use a repeating section to collect sales objectives from your sales team.

Display variable amounts of data on a form. For example, if your form template is connected to a database of employee records, you can use a repeating section to display matching records when a user queries the database from within InfoPath. If one record is returned, the user sees only one section on the form. If 10 records are returned, the user sees 10 sections.

Avoid empty placeholder areas that take up critical space on your form template.

Imagine an insurance application form template in which applicants must list the names and ages of their dependents. In a paper version of this form, you might see three placeholder fields, which assumes that most people have three or fewer dependents. Those who have more than three dependents would be forced to squeeze information about additional dependents under the existing fields or write on the back of the form.

In an InfoPath version of this form, you can use a repeating section so that applicants can easily add as many dependents as necessary. The following illustration shows how this might look to the person filling out the form.

When you insert a repeating section on your form template, you are essentially inserting an empty container. For the repeating section to be useful, you must insert other controls inside the repeating section.

Related controls

InfoPath includes other controls that are similar to repeating sections but that serve different purposes. To decide which of these controls works best on your form template, refer to the following list:

Repeating table If you want users to be able to add multiple rows to a table, consider using a repeating table instead of a repeating section on your form template. For example, you can present itemized data, such as invoice items, in a table format so that users can add additional rows to the table as necessary. Ultimately, using a repeating table instead of a repeating section is a matter of preference. Both controls allow you to collect or display multiple instances of the same type of data.

Section Sections are used to organize groups of related controls. If you use a section instead of a repeating section, users can't add additional sections to their form.

Repeating choice group Choice groups contain two or more sections. By default, one of these sections appears on the form. Users can choose to replace it with a different section. Choice groups can also be inserted on a form multiple times by the user.

Repeating recursive section Like a repeating section, a repeating recursive section can be inserted multiple times on a form. When users insert multiple instances of a repeating section, each new section is inserted beneath the preceding section, one after the other. With a repeating recursive section, however, each new section is inserted within an existing section, resulting in a set of nested sections. This is useful when you want to create hierarchical content, such as an outline.

Optional section If you add a repeating section to your form template, it will always appear on the form when a user first opens it. Optional sections, on the other hand, are hidden by default. Your users can choose whether to include the optional section on the form. For example, on a purchase order form, some users may want to comment on the supplies that they plan to order. You can insert an optional section and add a rich text box labeled Notes inside that optional section. Users can add the optional section if they need it by clicking instructional text beneath the optional section.

List control List controls are the simplest type of repeating control and are useful when you want users to be able to add as many items as necessary to a bulleted, numbered, or plain list. For example, you can use a bulleted list control to collect multiple action items in an issues list.

Master/detail control A master/detail control is a set of two related controls. The master control is always a repeating table. The detail control can be either a repeating table or a repeating section. You can use the master/detail control to link one control to another, so that the selection in the first control determines what appears in the second control.

The user experience

When users move their pointer over the repeating section, a blue button with an arrow on it appears in the upper-left corner. This is the shortcut menu button. Users can click this button to see options for inserting or removing the repeating section.

Insert a repeating section

The procedure for inserting a repeating section 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.

The following illustration shows how a repeating section looks when it is selected in design mode.

Controls can be bound or unbound. When a control is bound, it is connected to a field or group in the data source so that data entered into the control is saved in the underlying form (.xml) file. When a control is unbound, it is not connected to a field or group, and data entered into the control is not saved. When you select or move your pointer over a control, text and a binding icon appear in the upper-right corner of the control. The text indicates the group or field to which the control is bound in the data source. The icon indicates whether the control is correctly bound to that group or field. When the binding is correct, a green icon appears. If there's something wrong with the binding, you'll see a blue or red icon instead.

The data source for the form template consists of fields and groups that appear in a hierarchical view in the Data Source task pane. Repeating sections are usually bound to repeating groups in the form template's data source, although they can also be bound to repeating fields.

In the following example, the Dependents repeating section on the form template is bound to the dependent repeating group in the Data Source task pane. Each control in the repeating section is bound to a corresponding field that is part of the repeating section's group.

Insert a repeating section on a new, blank form template

When you design a new, blank form template, the Automatically create data source check box in the Controls task pane is selected by default. This enables InfoPath to automatically create fields and groups in the data source as you add controls to the form template. These fields and groups are represented by folder and file icons in the Data Source task pane.

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

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

Under Insert controls, click Repeating Section.

To add controls to the repeating section, drag the controls that you want from the Controls task pane into the repeating section on your form template.

Note: You should not move a control that is already on the form template into the section, unless the control's field is already part of the section's group in the data source. Otherwise, the binding for the control may break.

To add a label to the control, type text above it.

Insert a repeating section on a form template that is based on an existing data source

If you base the design of your form template on an existing Extensible Markup Language (XML) file, database, or Web service, InfoPath derives the fields and groups in the Data Source task pane from that existing data source. In this scenario, you can add a repeating section either by dragging a repeating group from the Data Source task pane onto the form template or by inserting the repeating section by using the Controls task pane, as described in the following procedure.

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

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

Under Insert controls, click Repeating Section.

In the Repeating Section Binding dialog box, select the repeating group in which you want to store repeating section data, and then click OK.

Add controls to the repeating section, and then bind them to the appropriate fields in the data source.

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

Tip: You can also use the Data Source task pane to insert controls. In the Data Source task pane, right-click the repeating group that you want to bind the repeating section to, and then click Repeating Section on the shortcut menu.

Layout tips

Before you insert controls into the repeating section, think about how you want to arrange those controls. You can add controls in a freeform fashion 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 repeating section and then insert labels and controls inside the individual cells so that they align nicely. In the following example, the form designer has used a one-row, three-column layout table to arrange controls inside a repeating section.

In addition to using layout tables, you can do one or more of the following:

To change the size of several repeating sections at once, select the repeating sections whose size you want to change, on the Format menu, click Properties, and then make the necessary adjustments on the Size tab.

To change the border or color of a repeating section, select it on the form template, on the Format menu, click Borders and Shading, click the Borders tab, and then make the necessary adjustments.

To see how controls in your repeating section will look with actual text in them, click Sample Data on the View menu. This helps you get a sense of what a form based on your form template will look like when a user fills it out.

On occasion, the text inside the controls in a repeating section and the labels to the left of those controls may appear to be slightly out of alignment. To quickly realign them, double-click the control, click Align on the Size tab, and then click Apply. If the label and control are in different cells in a layout table, right-click the cell that contains the label, click Table Properties on the shortcut menu, and then click Center under Vertical alignment on the Cell tab.

The Repeat vertically option is selected by default. This means that as users add repeating sections, those sections appear in a vertical formation down the length of the form. You can choose to make the repeating section expand horizontally instead. This allows you to create completely different layouts. For example, you can create a form template that resembles a calendar. The Repeat horizontally option is not supported in browser-compatible form templates.