About controls
When filling out forms, users enter information by typing in text boxes, clicking items in a list, selecting check boxes, and performing other actions. The objects that users interact with are called controls. Information that is entered into a control is stored in the form’s data source. When you design a form, you use the Controls task pane to insert controls.
You can customize a control’s appearance, including font, color, and alignment; its default value and data type; and other properties, such as the ScreenTip that appears when a user rests the mouse pointer on the control. You can also customize a control's behavior, such as its ability to filter information or respond to rules. To view the properties for a control, double-click the control on the form.
Controls and the data source
Almost all controls on a Microsoft Office InfoPath 2003 form are associated with, or bound to, the data source. Most controls, including text boxes, check boxes, and list boxes, are bound to fields. If a control is not bound, or if it is bound incorrectly, the information entered into the control cannot be saved. When you design an InfoPath form, you can choose to have the fields in the data source created automatically each time you insert a control, or you can bind controls to existing fields.
The following example illustrates the relationship between two drop-down list boxes and the fields that store their data.
Together, a control and its field determine the type of information that users can enter, as well as how they enter the information. For example, a date picker control makes it easy for users to enter dates. The field to which the date picker is bound saves only values that are dates (in other words, the field has a date data type).
Note In addition to the main data source for your form, you can create data connections to XML documents, databases, Web services, and Microsoft Windows SharePoint Services libraries and lists. These data connections result in secondary data sources that can be used to populate list boxes and provide the values for text boxes and other controls.
Inserting controls on your form
When designing a form, you can use the Controls task pane to insert controls. You can choose to create the data source automatically when you insert a control, in which case a field or group will be automatically created for each control that you add. You can also choose to bind the control to an existing field or group. If you choose this option, you are prompted to select a field or group from the data source when you insert the control. To switch between automatically creating the data source and binding the controls to an existing field or group, use the Automatically create data source check box in the Controls task pane.
You can also insert controls by dragging fields and groups from the Data Source task pane onto your form. Each time that you drag a field or group, InfoPath suggests the control that best matches the field or group. For example, if the field has a date data type, InfoPath suggests a date picker.
Types of controls
- Text box The most commonly used control on forms. Users can enter any type of unformatted text into a text box, such as sentences, names, numbers, dates, and times. Text boxes cannot contain formatted text.
- Rich text box A control that can contain formatted text, including bold and italic text, and a variety of fonts, font sizes, and font colors. In addition, users can insert images, lists, and tables into a rich text box.
- List box and drop-down list box Controls that present a list of choices in a box from which users select the appropriate item. The choices can come from a list that you create manually, from values in the form's data source, or from values that come from a data connection to an XML document, database, Web service, or Windows SharePoint Services library or list.
- Date picker A control that contains a box for users to type dates and a calendar button that allows users to select a date.
- Check box A control that allows users to easily indicate yes or no, and true or false values.
- Option button A control that lets users select from a set of mutually exclusive choices. When one option button in a group is selected, the other option buttons are cleared. A group of option buttons is bound to one field, and each option button saves a different value in that field.
- Button A control that can be used to submit a form or query a database, among other things. You can also associate a button with rules or custom code that runs when users click the button.
- Section A control that is a container for other controls. Sections can include any of the other controls listed in the Controls task pane.
Repeating and optional controls
Along with standard controls, InfoPath has list controls, repeating tables, repeating sections, and optional sections. These controls allow users to insert list items, rows, record sets, and optional information when filling out a form.
Repeating sections and repeating tables are usually bound to groups in the data source. Groups contain fields in the same way that sections and repeating tables contain controls. When you insert a section, repeating section, optional section, or repeating table, the structure of the data source must match the layout of the control. For example, if a text box is inside a repeating table, the field that the text box is bound to must be part of the group that the repeating table is bound to.
- Optional section A control that contains other controls and is useful for including extra information that is not necessary for all users to fill out. When filling out a form, users can choose whether to include an optional section on the form.
- Repeating section A control that contains other controls and is useful for presenting record-based data, such as employee database records. When filling out the form, users can add additional occurrences of a repeating section.
- Repeating table A control that displays repeating information in a tabular structure. Each item appears in a new row in the repeating table. When filling out the form, users can add or delete rows as necessary. Repeating tables contain other controls.
- Master/detail A control that is actually a set of two repeating controls that are directly related to one another. The master control is always a repeating table, and the detail control can be either a repeating table or a repeating section. Master/detail controls help users work more efficiently with large amounts of data. For example, if your form displays employee database records, you can specify that only a subset of information about each employee should appear in the master control. Then, when a user selects a record (row) in the master control, the detail control can display more detailed information about the employee.
- List Bulleted, numbered, and plain list controls are a good way to include simple text that repeats, such as a list of agenda items. When filling out a form, users can add or delete list items as necessary.
- File attachment A control that allows users to attach files to their form. Each file attachment control permits one file to be attached, and you can restrict the file type, if necessary. If your users want to attach multiple files, you can insert the file attachment control inside a repeating control.
- Picture A control that can be included on a form as a static element, such as a title or a background, or can allow users to insert a picture as part of the form. Picture controls can store the image on the form itself or store an address (URL) of the picture.
- Ink picture A control that allows users with a Tablet PC to create and save ink drawings, either within the control itself or on top of a background picture.
- Hyperlink A control that can be used to link to a URL. For example, a form showing information about a list of products can include hyperlinks to product information Web pages. Hyperlink controls can point to any Web server on either an intranet or the Internet.
- Expression box A read-only text control. You can use expression boxes to display read-only text, display the value of another control on the form, and create formulas based on XPath expressions.
- Vertical label A read-only text label that appears at a 90-degree angle on your form. Vertical labels are often used as column headings in repeating tables.
- Scrolling region A control that contains other controls, retains a fixed size, and includes scroll bars so that users can scroll to see information that is out of view. Scrolling regions are particularly useful when a section of a form contains a lot of data, and users do not need to see it all at once.
- Choice group A control that contains two or more choice sections that in turn contain other controls. Each choice section in a choice group serves as a single option in a set of mutually exclusive choices. When filling out a form, users can replace the default choice section with a different choice section. For example, on a job application form, you can use a choice group to allow users to enter either a home phone number or a work phone number for their references.
- Repeating choice group A control that displays two or more choice sections in a repeating structure. When filling out a form, users can add, delete, or replace additional repeating choice groups, as necessary. For example, on an employee information form, you can use a repeating choice group to let users enter multiple emergency contacts. For each contact, the user can replace home address information with work address information.
- Choice section A control that contains other controls and that should always appear inside choice groups or repeating choice groups. Choice sections are useful when you need to add more choices to an existing choice group. If you insert a choice section anywhere other than in a choice group, InfoPath automatically inserts the choice section inside a choice group.
- Repeating recursive section A control that contains other controls and can be inserted within itself. You can use repeating recursive sections to create hierarchical content, such as an outline.
Note The information in this topic may not apply if you are working with a form designed using Microsoft Office InfoPath 2003 without the service pack installed. Learn more