Reputation: 63
I am trying to use the Richfaces Calendar as a Month Picker instead of a Date Picker. Though the below code tags display the Month Picker as expected but the value of selected month and year is not submitted to the Backing Bean.
-----XHTML TAGs ----
<rich:calendar id="fromDate"
currentDate="#{numberManagementController.searchCriteria.fromDate}"
value="#{numberManagementController.searchCriteria.fromDate}"
showWeekDaysBar="false" datePattern="MMM-yyyy" showFooter="false"
popup="false" enableManualInput="false" showInput="false"
styleClass="numberMonthSelector" popupClass="numberCalendarPopup"
oncurrentdateselect="event.rf.component.__selectDate(event.rf.data)" />
<rich:calendar id="toDate" showWeekDaysBar="false" showFooter="false"
currentDate="#{numberManagementController.searchCriteria.toDate}"
value="#{numberManagementController.searchCriteria.toDate}"
oncurrentdateselect="event.rich.component.selectDate(event.rich.date)"
popup="false" styleClass="numberMonthSelector" popupClass="numberCalendarPopup"/>
-----CSS -------
.numberMonthSelector tr[id$="CalendarDateEditorLayoutTR"]
{
display: none;
}
.numberCalendarPopup tr[id]{
display:none;
}
Please help me out, stuck on the issue for couple of days.
Initial help was taken from here
Richfaces - 4.1.0.Final
Many Thanks Sachin Jain
Upvotes: 0
Views: 790
Reputation: 3884
You should use <a4j:ajax>
if you want to send a value to a bean in response to some event.
<rich:calendar id="fromDate"
currentDate="#{numberManagementController.searchCriteria.fromDate}"
value="#{numberManagementController.searchCriteria.fromDate}"
showWeekDaysBar="false" datePattern="MMM-yyyy" showFooter="false"
popup="false" enableManualInput="false" showInput="false"
styleClass="numberMonthSelector" popupClass="numberCalendarPopup">
<a4j:ajax event="currentdateselect"
onbeforesubmit="event.rf.component.__selectDate(event.rf.data)"
execute="@this"/>
</rich:calendar>
Upvotes: 0