A date picker is a control that lets users quickly enter dates in a Microsoft Office InfoPath form by clicking a small pop-up calendar. For example, you can use a date picker to collect birth dates from people on an insurance form. You can also use a date picker to display preset dates, such as the current date. Show
In this article
When to use a date pickerUse a date picker when you want to:
In the following illustration, a date picker is used on a travel request form template to collect the departure date for a flight.
You can customize the date picker to suit your needs by double-clicking the control on the form template and then changing its properties. For example, you can specify a default date or change the way that the date is displayed on the form. Top of Page The user experienceDate pickers look like text boxes, except that a small calendar icon appears on the right side of the box. To open the pop-up calendar, users click the calendar icon. When the calendar appears, users can click the date that they want on the calendar or use the right and left arrow buttons to scroll through the months. If users want to insert the current date, they can click the Today button at the bottom of the calendar.
Top of Page 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. Although date pickers are available when you design a browser-compatible form template, be aware of the following limitations:
Top of Page Insert a date pickerThe procedure for inserting a date picker 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 date picker looks when it is selected in design mode.
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. Date picker controls are always bound to fields. In the following example, the Departure date date picker on the form template is bound to the departureDate field in the Data Source task pane.
Insert a date picker on a new, blank form templateWhen 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.
Insert a date picker on a form template that is based on an existing data sourceIf 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. In this scenario, you can add a date picker either by dragging a date picker field from the Data Source task pane onto the form template or by inserting the date picker by using the Controls task pane, as described in the following procedure:
Tip: You can also use the Data Source task pane to insert controls. In the Data Source task pane, right-click the field that you want to bind the date picker to, and then click Date Picker on the shortcut menu. Top of Page Display the current date in a date pickerTo automatically insert the current date on a form when users open it, you can use the today function with a date picker control.
Top of Page Display the current date and time in a date pickerTo automatically insert the current date and time on a form when users open it, you can use the now function with a date picker control.
Top of Page Layout tipsUse the following tips to help you refine the appearance, size, and other aspects of a date picker:
Top of Page |