The issues comes when you manually add a date into the input field, if you add an invalid date the PrimeFaces calendar component takes its best guess at converting this into a valid date and then sending it, meaning that back-end validation is a no go. Some interesting translations below:
30/02/2012 becomes 2/6/2014
322/05/2012 becomes 5/10/2038
01/14/2012 becomes 4/1/2012
Same weirdness can be recreated on the PrimeFaces demo page.
I have seen solution around using the readOnlyInput='true' attribute but that only seems to prevent letters being entered in the field not number or slashes. Below is one instance of the calendar I have implemented, have I missed somthing silly? Apparently the PrimeFaces calendar used to be rock solid:
Code: Select all
<p:calendar id="fldDateOfBirth" value="#{pc_CreateUser.user.dateOfBirth}" binding="#{pc_CreateUser.dobComp}" navigator="true" pattern="dd/MM/yyyy" maxlength="10" yearRange="-100" validator="#{pc_CreateUser.validateDOB}" title="#{msg.user_date_format_default_tip}" converterMessage="#{msg.user_error_dob_invalid}" readOnlyInput="true" showOn="button" />
Similar question also asked on StackOverflow for future reference: http://stackoverflow.com/questions/1376 ... s-as-input