Primefaces日历允许无效日期 [英] Primefaces calendar allows invalid date

查看:63
本文介绍了Primefaces日历允许无效日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是primefaces日历,但是我可以输入无效的日期。例如在日期输入框中输入日期为32-06-2012并保存记录。与将日期保存为02-07-2012一样,它保存日期。在primefaces的展示中也可以观察到相同的行为。

I am using primefaces calendar but i am allowed to enter invalid date.For e.g. enter date as 32-06-2012 in the input box for date field and save the record. It is saving the date as is saving the date as 02-07-2012. Same behavior can be observed in showcase of primefaces also.

参考文献: http://www.primefaces.org/showcase/ui/calendarBasic.jsf

这是我的代码

<p:calendar id="copyStartDateCalendar" pattern="dd/MM/yyyy"

         mode="popup" showOn="button" size='8' >

                <f:convertDateTime pattern="MM/yyyy" />

</p:calendar>

应该做些什么,因为组件本身似乎存在一些错误。

What should be done as there seems to be some error with the component itself.

谢谢&问候

Tarun Madaan

Tarun Madaan

推荐答案

尝试使用 readonly = true 在这种情况下,您不需要使用任何服务器端验证器。此选项仅允许最终用户从日历面板中选择日期。

Try to use readonly="true" at such case you don't need to use any server side validators. This option will allow to the end user only to pick up the date from calendar panel.

这篇关于Primefaces日历允许无效日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆