Not able to format time in InfoPath 2010
Learn what a few workarounds are for the issue of not being able to format a time text box in InfoPath 2010.
I recently came across a minor but nagging bug in InfoPath 2010 where I was unable to format the time on a text box control.
These are the steps to reproduce the issue:
- Add a text box control to an InfoPath 2010 form template.
- Open the Field or Group Properties dialog box for the field that is bound to the text box control and set its data type to Time (time).
- Open the Text Box Properties dialog box for the text box control, and then on the Data tab, click Format behind the Data type drop-down list box. Alternatively, select the text box control and click Properties > Properties > Data Format on the ribbon.
- On the Time Format dialog box, if you select Display the time like this, click OK, and then reopen the Time Format dialog box, you will see that the format will remain on None (display XML value) and you will not be able to select a time format.
The workaround is to go back to the Text Box Properties dialog box, select a data type other than Time (time), reselect the Time (time) data type, and click Format again to format the time. Another option is to change the text box control properties values for Data Type and Data Format directly via the Properties tab on the ribbon.
In my InfoPath 2010 Cookbook I explained what the difference is between fields and controls in InfoPath and when/how to use each. In the case of this issue, you are better off adding the text box control to the form template and then changing the data type directly on the control rather than on the field bound to the control. This way the issue will not manifest itself and you won’t be confused as to why you are unable to select a time format for the text box.
Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent of S.Y.M. Wong-A-Ton. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author, S.Y.M. Wong-A-Ton.