LOV enabled date field throws date format error !

While working with LOV enabled attribute date fields, you might have experienced some strange date format error on UI - "The date is not in the correct format". The reason for this error is well documented in developers guide, please refer topic 5.12.5 How to Handle Date Conversion for List Type UI Components in Fusion Developer's Guide.

In simple words, the underlying run time mechanism tries to copy the selected date from the LOV pop-up to the target field using the date format specified for the attribute. This may fail to do so if the format turns out to be null/invalid. Here, you are supposed to specify date format for LOV enabled 'date' attribute of the view object(using Control Hints editor for the attribute). Later, this 'pattern' would be used by af:convertDateTime to convert string into Date.

<af:inputListOfValues id="startDateId"
    popupTitle="Search and Select: #{bindings.StartDate.hints.label}"
    .........
    shortDesc="#{bindings.StartDate.hints.tooltip}">
<f:validator binding="#{bindings.StartDate.validator}"/>
<af:convertDateTime pattern="#{bindings.StartDate.format}"/>
</af:inputListOfValues>

Comments

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of my employer.