Add picker controls

In a Microsoft InfoPath 2010 form template, you can add controls that enable users to select the date, time, or a user ID. The following sections detail each picker control that is available.

In this article


About picker controls

Date Picker

About picker controls

A date picker is a control that appears as text box with a calendar icon. This control can be used to let users quickly enter dates in an InfoPath form by either typing the date or clicking the small calendar icon, which displays a pop-up calendar. When the calendar appears, users click the date that they want on the calendar, or use the left and right arrow buttons to scroll through the months. If users want to insert the current date, and are using InfoPath Filler, they can click Today at the bottom of the calendar. If they are using a Web browser to fill out the form, then clicking Today focuses the calendar on the current date, but requires the user to click the date.

Use a date picker to obtain a date from a user, such as birth dates from people on an insurance form.

Date and Time Picker

About picker controls

A date and time picker control is a date picker control with an additional text box. This control can be used to allow users to quickly enter both dates and times in an InfoPath form. Users select or type the date from the date portion of the control, just like they would from a standard date picker, and they can indicate a corresponding time by typing it in the time portion of the control. For example, this control could be used if you wanted to indicate a date and time of a purchase on an invoice.

Use the date and time picker any time you would use a date picker control, but also want users to indicate a corresponding time.

Person/Group Picker

About picker controls

The person/group picker control allows users to type or select a user name from a SharePoint site that is designated when designing the form. The control is simple to set up because you only need to publish the form to a SharePoint site and it, by default, resolves users against the site the template is published to. You can also manually indicate which SharePoint site to retrieve the user information from for testing purposes or if you are creating a client only form.

Use a person/group picker control when you want users to select themselves or another user in response to a question (assigning a task to a co-worker).

Insert a picker control

The procedure for inserting a picker control 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.

Insert a picker control in a new, blank form template

  1. In the form template, place the cursor where you want to insert the control.
  2. On the Home tab, in the Controls group, click a control.

About picker controls

  1. To add a label to the control, type text above or to the left of the control. Or, for best practices, if you are using a layout table to organize the controls and labels, type the label of the control in the adjacent cell. For example, if you are inserting a date picker, then type “Date.”

Insert a picker control on a form template that is based on an existing data source

If you base the design of your form template on an external data source, the fields and groups in the Fields task pane are based on the existing data source. In this scenario, you can insert a picker control by dragging a field from the Fields task pane onto the form template or by inserting a picker control, as described in the following procedure:

  1. In the form template, place the cursor where you want to insert the control.
  2. In the Fields task pane, right-click a field from the external data source.

 Note    For the person/group picker control, right-click the non-repeating group that contains the repeating pc:Person group that contains the DisplayName, AccountID, and AccountType fields in the Fields task pane.

  1. Select a control to insert.
  2. The name of the field or group is used as the control label. If necessary, change the label text.

 Note    For the person/group picker control, to add a label to the control, type text above or to the left of the control. Or, for best practices, if you are using a layout table to organize the controls and labels, type the label of the control in the adjacent cell. For example, if you are inserting a date picker, then type “Date.”

 Note    You can also drag the field from the Fields task pane to the form. If you do this, the most appropriate control type is automatically selected. For the date and time picker and date picker controls, if the correct type is not selected by default, use the previous method to select the correct type, or right-click on the control, click Change Control, and then click the appropriate control type.

Top of Page Top of Page

Configure Picker Controls

Specify a SharePoint site for a Person/Group Picker control to query

The person/group picker needs to connect to a SharePoint site to be able to function. Specify the SharePoint site as follows, unless you have already published the form to a SharePoint site, in which case that site is used by default.

  1. Click the control, and then under Control Tools, on the Properties tab, in the Properties group, click Control Properties.
  2. In the Person/Group Picker Properties dialog box, click the SharePoint Server tab.
  3. Type the URL of the SharePoint site that you want to query.

About picker controls

  1. Click OK.

Require a value to be entered

It is possible to require a field to not be blank. Users are not able to submit a form without entering a valid value into the control. To mark a field as requiring a value, do the following:

  1. Select the control in the view.
  2. On the Properties tab, in the Modify group, select the Cannot be blank check box.

Top of Page Top of Page

Advanced concepts

Refine person/group picker choices

By default, the person/group picker control allows you to select one individual person from anyone on the SharePoint site. However, you can allow multiple selections of people and groups, or only people from one group.

  1. Select the person/group picker control then, under Control Tools, on the Properties tab, in the Properties group, click Control Properties.
  2. Click the General tab.

About picker controls

  • Make any changes that you want.
  • Allow multiple selection
   

When selected, multiple users can be selected. Each entry must be separated user by a semi colon (;).

  • Allow selection of
   

Click People and Groups to enable users to select both people, and groups, from the person/group picker control. By default, People Only is selected.

  • SharePoint Groups
   

To limit the selection of users and groups, click SharePoint Group, and then select the group from the drop-down list. If the list is not constrained, users are able to select from any person and group.

Display the current date in a date or date and time picker

To automatically insert the current date on a form when users open it, use the today() or now() function.

  1. Select the date picker or date and time picker control.
  2. Under Control Tools, from the Properties tab, in the Properties group, click Control Properties.
  3. On the Data tab, in the Default Value section, click the command button next to the Value box.
  4. Click Insert Function.
  5. Click Date and Time.
  6. Click today() to insert only the date in a date picker control or now() to insert the date and time in a date and time picker control.

Change how a date or time is displayed in a date picker or date and time picker control

Do the following to specify how dates and times are displayed only for date picker or date and time picker controls:

  1. Select the date picker or date and time picker control that is used to capture or display the data you want to format.
  2. Under Control Tools, on the Properties tab, in the Properties group, click Control Properties.
  3. Click the Data tab.
  4. Ensure that the Data type list displays the appropriate data type, and then click Format.
  5. In the Format dialog box, click the appropriate country or region for the form from the Locale box, and then click the corresponding calendar from the Calendar box if displaying a date and more than one option is available.
  6. Do the following, as is appropriate:
  • If you selected date or date and time for the data type, to format the way the control displays the time, select the display style that you want in the Display the date like this list.
  • If you selected time or date and time for the data type, to format the way the control displays the time, select the display style that you want in the Display the time like this list.

 Note    If you are designing a form that will be filled out in multiple regions, it is a best practice to use date formats that have an asterisk (*) next to them. For Filler forms, date formats with an asterisk next to them (*) are automatically displayed based on the regional and language operating system settings of the user’s machine. Web browser forms automatically display the date based upon the regional settings of the SharePoint site that is hosting the form. For instance, dates will display in the format m/d/y for users with English (US) settings and d/m/y for users with English (Ireland) settings.

Remove formatting from a date, time, or number

You can remove the formatting from dates, times, and numbers that are displayed in a date pickers or text boxes that have a date, time, date and time, whole number, or decimal data type.

  1. Select the control.
  2. Under Control Tools, on the Properties tab, in the Properties group, click Control Properties.
  3. Click the Data tab.
  4. Click Format.
  5. Select None (display XML value).

 Note    When you remove the formatting from a date, time, or number, the displayed value for the date, time, or number will exactly match the value that is saved in the form's data source.

Top of Page Top of Page

 
 
Applies to:
InfoPath 2010