Reputation: 195
I have an input date filed in the jsf file in my project. The user can choose some date from the calendar and the date should be validated to be 7 days before and 7 days after the today`s day. I suppose that af:validateDateTimeRange will do the job, but I do not know how to build the EL so that it can exactly take the current date and to add or subtract fixed amount of days from it.
Could you please help me?
Thank you!
Upvotes: 1
Views: 1923
Reputation: 62864
<af:validateDateTimeRange>
is your best friend here. You have to set its minimum
and maximum
properties to some "yyyy-MM-dd"
formatted dates (which you can retrieve from a managed bean):
<af:validateDateTimeRange
minimum="#{managedBean.sevenDaysBeforeToday}"
maximum="#{managedBean.sevenDaysFromToday}"
messageDetailNotInRange="Date {1} does not fall within the range {2} : {3}"/>
Upvotes: 2