我需要比较两个日历日期。我也写了javascript函数。但是我如何执行这个函数(哪个事件?)是否从datePicker中选择日期?请参阅我的JSF代码
<h:outputText value="From Date" />
<p:calendar id="fDate" value="#{backingBean.fDate}" mode="popup"
showOn="button" pattern="dd/MM/yyyy">
</p:calendar>
<p:message id="fId" for="fDate" />
<h:outputText value="To Date" />
<p:calendar id="tDate" value="#{backingBean.tDate}" mode="popup"
showOn="button" pattern="dd/MM/yyyy" ondateselected="compareDate();" />
<p:message id="tId" for="tDate" />ondateselected="compareDate();根本没有执行,我想这是错误的。我在JSF2中使用primefaces-3.0.M3。
发布于 2012-01-16 20:10:03
不确定他们什么时候将其更改为使用p:ajax,但可能是在3.0M3之前
所以试着这样做
<p:calendar value="#{backingBean.tDate}">
<p:ajax event=”dateSelect” oncomplete="compareDate();return false;" />
</p:calendar>现在,当我再次考虑它的时候,我想你可以把js函数放在onsuccess="“中,去掉返回值false;
https://stackoverflow.com/questions/8879167
复制相似问题