Insert a section InfoPath 2007
Author: mety Labels:: Insert a section InfoPath 2007You can use a section to organize groups of related controls on a Microsoft Office InfoPath form template. Use a section when you want to organize a set of related controls on your form template. For example, on an insurance claim form template, you might use a section to group a set of text boxes that are used to collect contact information from policyholders. You can also use conditional formatting (conditional formatting: The process of changing the appearance of a control, including its visibility and read-write state, based on values entered into the form.) to show or hide sections that are based on values that users enter elsewhere 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. When you insert a section onto your form template, you are essentially inserting an empty container. For the section to be useful, you must insert other controls inside it. These controls might include text boxes, list boxes, or even other sections. Tip By default, section borders are invisible on the form. If you want an outline to appear around your section that is similar to the one shown on the insurance claim example, you can apply a border to the section in the Borders and Shading dialog box. Related controlsInfoPath includes other controls that are similar to sections but that serve different purposes. To decide which of these controls works best on your form template, refer to the following list: Repeating section To create a section that users can insert onto a form multiple times, use a repeating section or another repeating control. Optional section If you add a section to your form template, it will appear on the form when a user first opens it. Optional sections, on the other hand, are hidden by default. Users can choose whether to insert the optional section on their form. Choice group To insert a section that can be replaced with another section, use a choice group. A choice group contains two or more sections. By default, one of these sections appears on the form. Users can choose to replace it with a different section. Insert a sectionThe procedure for inserting a 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 section looks in design mode (design mode: The InfoPath design environment in which you can create or modify a form template.). 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. Sections are always bound to groups in the form template's data source. Each control in a section is bound to a field (field: An element or attribute in the data source that can contain data. If the field is an element, it can contain attribute fields. Fields store the data that is entered into controls.) that is part of the section's group. In the following example, the Policyholder Information section on the form template is bound to the addressPolicyholder group in the Data Source task pane. Insert a section on a new, blank form templateWhen 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.
Insert a section on a form template that is based on an existing data sourceIf 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 section either by dragging a repeating group from the Data Source task pane onto the form template or by inserting the section by using the Controls task pane, as described in the following procedure:
Hide a section based on values in the formConditional formatting isn't just for applying formatting changes to controls. One of the best ways to use conditional formatting is to show or hide a control that is based on the value that is entered in another control. A typical way to do this is to design your form with a check box above a section, so that selecting the check box shows or hides the section. This technique makes it easy for you to show the right information at the right time. This procedure assumes that you already added a section to your form template.
Layout tipsBefore you insert controls onto a section on a form template, 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 (layout table: A collection of cells used to arrange form content such as text or controls.) inside the section and then insert labels and controls inside the individual cells so that they align nicely. In the following example, the form designer used a two-row, three-column layout table to arrange controls inside a section. In addition to using layout tables, you can do one or more of the following:
|