Introduction to controls InfoPath 2007
Author: mety Labels:: Introduction to controls InfoPath 2007All Microsoft Office InfoPath forms that users fill out are based on an underlying form template. The form template determines how the resulting form looks and behaves. 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 graphical user interface objects that users interact with are called controls. You use controls to display data or choices, perform an action, or help make the form's user interface easier to read. In addition to standard controls, such as text boxes and list boxes, InfoPath includes a number of new controls, such as repeating tables, choice groups, and optional sections. These types of controls let you design a flexible form template that accommodates your users. For example, in an expense report form template, you can use a repeating table to allow users to enter only as many expense items as they need. Information that users enter into a control is stored in the form's data source (data source: The collection of fields and groups that define and store the data for an InfoPath form. Controls in the form are bound to the fields and groups in the data source.). When you design a form template, you typically use the Controls task pane to insert controls, although you can also insert controls by dragging fields (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.) and groups (group: An element in the data source that can contain fields and other groups. Controls that contain other controls, such as repeating tables and sections, are bound to groups.) from the Data Source task pane onto the form template. You can customize a control's appearance, including the font, color, and alignment of text inside the control, the control's default value and data type (data type: Property of a field that defines the kinds of data the field can store. Examples of data types include Text, Rich Text, Whole Number, Decimal, True/False, Hyperlink, Date and Time, and Picture.), and other properties, such as the ScreenTip (ScreenTip: A short description that appears when the user holds the mouse pointer over an object, such as a button or hyperlink.) 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 (rule: A condition or action, or a set of conditions or actions, that automatically performs tasks based on events and values in the form.). Tip To view the properties for a control, double-click the control on the form template Controls and the data sourceAlmost all of the controls on an InfoPath form are associated with, or bound (bind: To connect a control to a field or group in the data source so that data entered into the control is saved. When a control is unbound, it is not connected to a field or group, and so data entered into the control will not be saved.) to, the form template's data source. Most controls, including text boxes, check boxes, and list boxes, are bound to fields in the data source. If a control is not bound to the data source, or if it is bound incorrectly, the information that is entered into that control cannot be saved properly in the underlying form (.xml) file. When you design an InfoPath form template, you can choose to have the fields in the data source created automatically each time you insert a control, or you can manually bind each control to an existing field yourself. In the following example, the form designer inserted a Last Name text box on the form template. The text box is bound to the lastName field in the form template's data source. When filling out a form based on this form template, the user enters his or her name in the Last Name text box. InfoPath saves that data as Extensible Markup Language (XML) (Extensible Markup Language (XML): Industry-standard language for describing, organizing, and exchanging data. In InfoPath, form templates are based on XML technologies, and form data is saved or submitted in XML format.), as shown in the following image. Together, the type of control and its associated field determine the type of information that users can enter into the control, as well as how users can enter that information. For example, if you have a date picker control on your form template that is bound to a field with a date data type (data type: Property of a field that defines the kinds of data the field can store. Examples of data types include Text, Rich Text, Whole Number, Decimal, True/False, Hyperlink, Date and Time, and Picture.), then users can enter only dates into that control. If they try to enter other data, such as their name or address, into that control, InfoPath will show a data validation error. Note In addition to the main data source for your form template, you can create data connections (data connection: The connection between an InfoPath form and an external data source, such as a database, Web service, SharePoint library, or XML file. Data connections are used to query and submit data.) to XML documents, databases, Web services, and Microsoft Windows SharePoint Services libraries and lists. These data connections result in secondary data sources (secondary data source: An XML data file, database, or Web service that is used by a form for the entries in a list box or for script actions.) that can be used to populate list boxes and provide the values for text boxes and other controls. Ways to insert controls on a form templateWhen designing a form template, you can use the Controls task pane to insert controls. You can choose to create the form template's data source automatically when you insert a control, in which case a field or group will be automatically created in the data source for each control that you add. Alternatively, you can choose to bind each control to an existing field or group in the form template's data source. If you choose this option, you are prompted to select a field or group from the data source when you insert a control. Tip 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 template. Each time that you drag a field or group onto your form template, 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 controlsThe Controls task pane includes more than 30 different controls that you can add to your form template. These controls can be grouped in the following categories:
The following tables describe the purpose of each control. Standard controlsStandard controls include the controls that you typically associate with collecting and displaying information. These controls include text boxes, list boxes, check boxes, and buttons.
Repeating and optional controlsRepeating and optional controls include 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.
File and picture controlsYou can design your form template so that users can insert file attachments or pictures when they fill out forms that are based on your form template. In addition, users who fill out InfoPath forms on a Tablet PC benefit from a special ink picture control that lets them create and save ink drawings.
Advanced controlsAdvanced controls are controls that may be used less frequently than standard controls or only in special circumstances.
Custom controlsYou can use the Add Custom Control Wizard to make custom controls, including Microsoft ActiveX controls (ActiveX control: A custom control. Form designers can add or remove ActiveX controls in the Controls task pane.) and template parts, available in InfoPath. A custom control is one that is not included in InfoPath by default.
Compatibility considerationsWhen you design a form template in InfoPath, you can choose a specific compatibility mode to design a browser-compatible form template. When a browser-compatible form template is published to a server running InfoPath Forms Services, and then browser-enabled, forms based on the form template can be viewed in a Web browser. When you design a browser-compatible form template, some controls are unavailable in the Controls task pane because they cannot be displayed in a Web browser. The following controls are not supported in browser-compatible form templates:
You can also choose to design Microsoft Office InfoPath 2007 form templates that are compatible with Microsoft Office InfoPath 2003. In backward-compatible form templates, combo boxes and multiple-selection list boxes are not supported. When users open the form template in InfoPath 2003, combo boxes appear as drop-down list boxes, and multiple-selection list boxes appear as bulleted lists. If you have a particular part of a form template that you want to reuse in other form templates, you can design a template part. A typical template part consists of controls and a data source and may also include features such as data connections, data validation, and rules. In template parts, ActiveX controls are not supported and are consequently hidden in the Controls task pane. In addition, if you design a browser-compatible template part, you have access to fewer controls and features than you would if you were designing the template part solely for use in InfoPath. Remove a control from a form templateTo remove a control from a form template, you select the control and then press the DELETE key. When you remove a control, the field that is bound to that control remains in the data source. However, a form that is based on this form template will not show the data stored in this field. To display the data, you bind a control to the field. If you want to bind a different control to the field, instead of deleting the control, you can change the control to a different type. You do this by right-clicking the control, clicking Change To, and then clicking one of the choices on the menu. The menu displays only the types of controls that can be bound to this type of field. |