Project Documentation

Summary

Tag name: <tr:validateDateRestriction>

type: org.apache.myfaces.trinidad.DateRestriction

Validate that the date is valid with some given restrictions.

Code Example(s)

<tr:inputDate id="days" value="#{bean.date}"
                                  label="Select a date, but check possible holidays first">
                <tr:convertDateTime pattern="yyyy-MM-dd"/>
                <tr:validateDateRestriction  invalidDays="#{bean.date.nationalHolidays}" />
              </tr:inputDate>
              
              <tr:inputDate id="month" value="#{bean.date}"
                                  label="Select a date, but not within November or December">
                <tr:convertDateTime pattern="yyyy-MM-dd"/>
                <tr:validateDateRestriction  invalidMonths="Nov Dec" />
              </tr:inputDate>
              
              <tr:inputDate id="daysOfWeek" value="#{bean.date}"
                                  label="Select a date, but not a Monday">
                <tr:convertDateTime pattern="yyyy-MM-dd"/>
                <tr:validateDateRestriction  invalidDaysOfWeek="Mon"/>
              </tr:inputDate>

Attributes

Name Type Supports EL? Description
disabledbooleanYes Default Value: false

Whether the converter should be disabled, default to false.
invalidDaysorg.apache.myfaces.trinidad.model.DateListProviderYes To specifiy a concrete List of Dates, use the invalidDays attribute and wire it to a DateListProvider implementation. This returns a list of dates, which are invalid.
invalidDaysOfWeekString[]Yes Specify the weekdays which are invalid for your use case. The attribute takes whitespace delimited list of weekdays. Possible values are sun, mon, tue, wed, thu, fri, sat.
invalidMonthsString[]Yes Specify the month which are invalid for your use case. The attribute takes a whitespace delimited list of months. Possible values are jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec.
messageDetailInvalidDaysStringYes

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

Parameters:

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

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

Parameters:

  • {0} the label that identifies the component
  • {1} value entered by the user
  • {2} the invalid weekday
messageDetailInvalidMonthsStringYes

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

Parameters:

  • {0} the label that identifies the component
  • {1} value entered by the user
  • {2} the invalid month