0

Following is the code of rich:calendar I am using in a JSF form

<rich:message for="biddate" id="bidDateErrMsg"/>
<rich:calendar id="biddate" showWeeksBar="false" datePattern="MM/dd/yyyy" inputSize="10" maxlength="10" value="#{bean.bidDate}" enableManualInput="true" converterMessage="Invalid Date"></rich:calendar>

Since enableManualInput is set to true, Users can enter date manually as well. In datePattern 'MM/dd/yyyy', the year part should accept Integers only. But it is accepting alphabets as well.

After submitting the jsf form, rich:calendar's converterMessage is not getting shown when I enter alphabets in the last three digits of the date as shown below

01/01/2k13
01/01/20k3
01/01/201k

and the form gets submitted, which is wrong.

When I enter alphabet in the other places of the date as shown below,

01/01/k013
01/0k/2013
0k/01/2013

converterMessage is shown on the screen and form is not submitted, which is correct.

Is this a defect in rich:calendar or Am I doing anything wrong here?

Selva
  • 338
  • 2
  • 12

1 Answers1

0

It's how the parser works (in Java), yyyy pattern accepts any number of digits not just four. See here for more details.

Community
  • 1
  • 1
Makhiel
  • 3,874
  • 1
  • 15
  • 21