The mentioned example demonstrates how to implement specific validation for the af:inputdate component.
Use Case: Application expects the entered date to be atleast 18 Years from current date
jspx code:
<af:inputDate value="#{bindings.Dob.inputValue}"
label="Date Of Birth" autoSubmit="true"
shortDesc="#{bindings.Dob.hints.tooltip}" id="id1">
<f:validator binding="#{bindings.Dob.validator}"/>
<af:convertDateTime pattern="#{bindings.Dob.format}"/>
<af:validateDateTimeRange maximum="#{pageFlowScope.BackingBean.userDOBMax}"/>
<af:convertDateTime hintDate=" " messageDetailConvertDate=" "/>
</af:inputDate>
Here the af:validateDateTimeRange is binded to backing bean method named userDOBMax which is defined as follows:
public Date getUserDOBMax() {
Calendar now = Calendar.getInstance();
now = Calendar.getInstance();
now.add(Calendar.YEAR, -18);
return now.getTime();
}
specific validations can be implemented as per the requirement
Use Case: Application expects the entered date to be atleast 18 Years from current date
jspx code:
<af:inputDate value="#{bindings.Dob.inputValue}"
label="Date Of Birth" autoSubmit="true"
shortDesc="#{bindings.Dob.hints.tooltip}" id="id1">
<f:validator binding="#{bindings.Dob.validator}"/>
<af:convertDateTime pattern="#{bindings.Dob.format}"/>
<af:validateDateTimeRange maximum="#{pageFlowScope.BackingBean.userDOBMax}"/>
<af:convertDateTime hintDate=" " messageDetailConvertDate=" "/>
</af:inputDate>
Here the af:validateDateTimeRange is binded to backing bean method named userDOBMax which is defined as follows:
public Date getUserDOBMax() {
Calendar now = Calendar.getInstance();
now = Calendar.getInstance();
now.add(Calendar.YEAR, -18);
return now.getTime();
}
specific validations can be implemented as per the requirement