Foundation
Project Documentation

Summary

Tag name: <tr:validateDateTimeRange>

type: org.apache.myfaces.trinidad.DateTimeRange

Validate that the date entered is within a given range.

Example(s):

<tr:inputDate id="mdf3" value="#{date.date3}"
                               label="max validator">
  <tr:validateDateTimeRange maximum="#{date.maxDate}"/>
</tr:inputDate>

<tr:inputDate id="mdf3" value="2004-11-25"
                                tip="min=2004-11-16  max=2004-12-16"
                                label="Submission period">
  <tr:convertDateTime pattern="yyyy-MM-dd"/>

  <!-- Supports ISO date format strings of the form "yyyy-MM-dd" -->
  <tr:validateDateTimeRange
       minimum="2004-11-16"
       maximum="2004-12-16"
       messageDetailNotInRange="Date "{1}" does not fall within the range {2} : {3}"/>
</tr:inputDate>

Attributes

Name Type Supports EL? Description
maximum java.util.Date Yes the maximum java.util.Date. ISO 8601 date strings, of the form 'yyyy-MM-dd' (for example 2004-06-22) is also allowed. This will be parsed to date. When binding to Date objects, it is advised to create the Date object with maximum value for any date-time components that aren't displayed (usually hours, minutes, seconds, milliseconds) to allow the largest range of values to be accepted.
messageDetailMaximum String Yes

The detail error message to be used for constructing faces messages, when input value exceeds the maximum value set.

Parameters:

  • {0} the label that identifies the component
  • {1} value entered by the user
  • {2} the maximum allowed date

messageDetailMinimum String Yes

The detail error message to be used for constructing faces messages, when input value is less than the set minimum value.

Parameters:

  • {0} the label that identifies the component
  • {1} value entered by the user
  • {2} the minimum allowed date

messageDetailNotInRange String Yes

The detail error message to be used for constructing faces messages, if input value is not with in the range, when minimum and maximum is set.

Parameters:

  • {0} the label that identifies the component
  • {1} value entered by the user
  • {2} the minimum allowed date
  • {3} the maximum allowed date

minimum java.util.Date Yes The minimum java.util.Date. ISO 8601 date strings, of the form 'yyyy-MM-dd' (for example 2004-06-22) are also allowed. This will be parsed to date. When binding to Date objects, it is advised to create the Date object with zeroed-out values for any date-time components that aren't displayed (usually hours, minutes, seconds, milliseconds) to allow the largest range of values to be accepted.]]