Insert a list box
You can create a list box or drop-down list box on your form so that users can enter predefined values. List boxes are bound to fields and can look up values in a fixed list, in other parts of the form, or through a data connection to an XML document, a Microsoft Access database, a Microsoft SQL Server database, a Web service, or a Microsoft Windows SharePoint Services library or list.
- In design mode, place the insertion point where you want to insert the list box.
- If the Controls task pane is not visible, click More Controls on the Insert menu.
- In the Controls task pane, do one of the following:
- To automatically create a field in the data source that is bound to the list box, select the Automatically create data source check box.
- To bind the list box to an existing field, clear the Automatically create data source check box.
Note If the check box is unavailable, the form's design does not allow the data source to be automatically created.
- Under Insert controls, click List Box or Drop-Down List Box.
- If you cleared the Automatically create data source check box in step 3, select a field in the Control Binding dialog box to which you want to bind the list box.
- Double-click the list box that was inserted on the form.
- In the List Box Properties
dialog box, do one of the following:
Insert a list box that looks up values in a fixed list
- On the Data tab, click Add.
- In the Value box in the Add Choice dialog box, type the text that you want to store if a user selects this entry.
- In the Display name box, type the text that you want to display for this entry, and then click OK.
- Repeat steps 1 through 3 for each entry that you want to add to the list box.
- To test the list box, click Preview Form on the Standard toolbar.
Insert a list box that looks up values in another part of the form
Note The values displayed in this type of list box will change when users enter data on the form.
- On the Data tab, click Look up values in the form's data source.
The entries in the list box must be associated with a particular repeating group or repeating field on your form.
- Click Select XPath next to the Entries box, and then, in the Select a Field or Group dialog box, click the group or field that contains the fields that provide the values for the list box, and then click OK.
- Click Select XPath next to the Value box, and then, in the Select a Field or Group dialog box, click the field that contains the values that are stored on the form when a user clicks an item in the list box, and then click OK.
- Click Select XPath next to the Display name box, and then, in the Select a Field or Group dialog box, click the field that contains the values that are displayed in the list box, and then click OK.
Insert a list box that looks up values by using a data connection
- On the Data tab, click Look up values in a data connection to a database, Web service, file, or SharePoint library or list.
- Do one of the following:
- If you already added a data connection, click it in the Data Connection box.
- To add a new data connection, click Add, and then follow the instructions in the Data Connection Wizard.
The entries in the list box must be associated with a particular repeating group or repeating field.
- Click Select XPath next to the Entries box, and then, in the Select a Field or Group dialog box, click the group or field that contains the fields that provide the values in the list box, and then click OK.
- Click Select XPath next to the Value box, and then, in the Select a Field or Group dialog box, click the field that contains the values that are stored on the form when a user clicks an item in the list box, and then click OK.
- Click Select XPath next to the Display name box, and then, in the Select a Field or Group dialog box, click the field that contains the values that are displayed in the list box, and then click OK.
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