tags:

views:

50

answers:

2

I m using a rich:calendar to display Date in my application But some how date validation isn't working properly in a particular scenario. i.e it some one enters date as 05/05/2010sfc in this case it automatically trims the extra characters in the end and displays date properly in next page instead of giving an error of invalid date on same page.

It works in other cases such as asd05/05/2010, 05sfa/05/2010, etc

I tried using but it didn't help

Can anyone please help me on this...

+1  A: 

That's indeed how SimpleDateFormat (which it is using under the hoods) by default works.

Best what you can do is to restrict the input field max length to 10 or supply a custom date validator.

BalusC
Thnx BalusC that helped
Vipin
You're welcome. Don't forget to mark the answer accepted if it helped in solving the problem/question. See also http://stackoverflow.com/faq
BalusC
A: 

I used this tag to restrict the length to 10 characters

< rich:calendar value="#{myBean.date}" datePattern="MM/dd/yyyy" enableManualInput="true" inputStyle="width:80px"> < f:attribute name="maxlength" value="10"/> < /rich:calendar>

Vipin