XPages Date Picker: My Preference

Home » XPages Date Picker: My Preference

Today I took part in the Ask The Xperts webinar by GBS and TLCC. One of the questions was about problems with the XPages date picker in Internet Explorer 8. When not in compatibility mode, the page refreshes as soon as the user clicks on the date picker. There may be times when you want to avoid compatibility mode, for example, when using the CSS float property.

My preferred option to get around this is to use the Dojo date picker. However, if the Dojo module is applied to the inputText tag itself, the date is handled as a JavaScript date object. This can cause some challenges when it comes to validation. You can get round this by applying the Dojo module to the dateTimeHelper, so using code like this:

<xp:inputText value="#{myDoc.Date}" id="date1">
<xp:dateTimeHelper id="dateTimeHelper2" dojoType="dijit.form.DateTextBox">
</xp:dateTimeHelper>
<xp:this.converter>
<xp:convertDateTime type="date" dateStyle="short">
</xp:convertDateTime>
</xp:this.converter>
</xp:inputText>

Remember to add the dojo module to the XPage / Custom Control and set dojoParseOnLoad and dojoTheme to “true”. This will then apply the Dojo date picker to the inputText control, while allowing validation to be done on the converted value in the same way as you would do if you were using the normal date picker.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top