Tuesday 7 June 2016

Restricting the display of future dates in af:inputDate component

The input date component in Oracle ADF has some useful attributes for validating the dates like minimum acceptable date and maximum date allowed.

But to disable the future date in the input date comportment we can use the max value property by pointing it to a backing bean method as explained in the blog. http://www.adftutorials.com/disable-future-date-on-adf-inputdate-component.html. After implementing the code, the input date is throwing an error The date must be on or before 08-Jun-2016 when you select the current date.

Use the below solution to make it work.

  1. Create a transient date attribute of type oracle.jbo.domain.Date.
  2. Mark the default value as expression and paste new java.sql.Timestamp((adf.currentDate +1 ).time-1)
  3. Create an attribute binding to the page that shows the input date.
  4. Now use the transient attribute value in the max value of  the input date in the page like
                  <af:inputDate id="id4" label="Date"   autoSubmit="true"  
                      maxValue="#{bindings.LimitDate.inputValue}"

                      disabled="true"/>

No comments:

Post a Comment