开发者

Date Validation in JSF & Richfaces

I m using a rich:calendar to display Date in my application But some how date validation isn't working properly in a part开发者_JAVA百科icular 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...


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>


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜