Primefaces calender: how to set dynamically mindate

jakarta-eejsfjsf-2primefaces

I have two primefaces calender controls.I want that when I select a date from the first calender then next calender mindate should be start from 1st calender's selected date.For instance, I have selected 7/5/2013 then next calender should disable all dates before 8/5/2013
This is what I have tried so far but it is not working

   <p:calendar id="fromD" value="#{requestController.from}" yearRange="2013:2015" pattern="dd/MM/yyyy" mindate="#{requestController.today}"/>

<p:calendar id="toD" value="#{requestController.to}" yearRange="2013:2015" pattern="dd/MM/yyyy" mindate="#{requestController.from}"/>

Any suggestions?

Best Solution

From change event , you can't submit the value of date.You need to change the event to dateSelect
Just do

<p:ajax event="dateSelect" update="toD"/>

It will reset the mindate for your next calender/component

Related Question