Insert a combo box InfoPath 2007
Author: mety Labels:: Insert a combo box InfoPath 2007A combo box is a text box with a list box attached. This type of control enables users to select a predefined value in a list or type their own value in the text box portion of the control. The list is hidden until the user clicks the arrow next to the box. Use a combo box when you want to:
In the following illustration, users categorize expenses in an expense report form by selecting values in a combo box. If they don't see the value that they need, they can type it in the box instead of selecting a value in the list. In this example, the user is in the process of typing the words Phone/Fax. After you insert a combo box on your form template, you must specify the values that you want to appear in it. Otherwise, users will see an empty list when they click the arrow next to the combo box. In the Combo Box Properties dialog box, you can type the entries yourself or configure the combo box to retrieve entries from a database or other data source. Related controlsMicrosoft Office InfoPath includes other controls that are similar to combo boxes but that serve different purposes. To decide which of these controls works best on your form template, refer to the following list: List box Like a combo box, a list box allows users to select values in a list. However, users cannot add their own values to a list box. Also, a list box displays all of the items in the list, whereas the items in a combo box are hidden until the user clicks the control. If you plan to offer the user many choices in your control, list boxes may take up too much space on your form template. In this scenario, a drop-down list box or combo box may be a better choice. Drop-down list box Like a combo box, a drop-down list box enables users to select a value in a list that is hidden on the form by default. However, with a drop-down list box, users cannot add items to the list as they can with a combo box. Multiple-selection list box If you want users to be able to choose more than one item in a list, you can use a multiple-selection list box. Multiple-selection list boxes look like two or more check boxes inside a scrollable list. Like a combo box, a multiple-selection list box enables users to add their own item to the list. Option buttons Like a combo box, a group of option buttons enables users to select from a list of mutually exclusive choices. However, with option buttons, users click a small circle to make a choice instead of clicking an item in a list box. The user experienceCombo boxes are similar in appearance to drop-down list boxes, but they allow users to add their own item to the list, if necessary. If you manually typed your own list items in the Combo Box Properties dialog box when creating a combo box, InfoPath displays the text "Select or type..." as the default entry in the combo box. This lets users know that either action is acceptable. If the list items in the combo box display values from elsewhere on the form or from a secondary data source (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.), the "Select or type..." text is omitted. When users first open a form, the list items in a combo box are hidden. To open the list, users click an arrow on the right side of the combo box. They can then click an item to select it. If users don't see an appropriate list item, they can click in the box and type their own value. Compatibility considerationsWhen you design a form template in InfoPath, you can choose to design a browser-compatible form template (browser-compatible form template: A form template that is designed in InfoPath by using a specific compatibility mode. A browser-compatible form template can be browser-enabled when it is published to a server running InfoPath Forms Services.). When you design a browser-compatible form template, combo box controls are unavailable in the Controls task pane because they cannot be displayed in a Web browser. Insert a combo boxThe procedure for inserting a combo box 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 combo box looks when it is selected 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. Combo boxes are always bound to 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.). In the following example, the Category combo box on the form template is bound to the category field in the Data Source task pane. 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. 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. Insert a combo box
Layout tipsUse the following tips to help you refine the appearance, size, and other aspects of a combo box control:
|