You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

<hx:inputDateTime>

Extends: h:inputText
Attributes not present in ancestor:

Name

Required?

Values

Description

type

optional

'datetime'(default), 'date', 'time', 'month', 'week', 'datetime-local'

Type of the date-time input. Type names are exactly the same with the html5 spec, in order to keep things more self-explained.

suggestions 

optional

Can be comma seperated strings, array and collection of "javax.faces.SelectItem"s

Static(not Ajax or smthg) suggestion values. this attribute should not be defined if "datalist" is set.

required

optional

EL and literal

Same with h:inputText 'required' except, 'required' attribute of HTML 'input' element is used this time

autocomplete

optional

'true' or 'false'. By default nothing will be rendered.

To override owner form's autocomplete attribute for its children.

autofocus

optional

'true' of 'false'(default)

As soon as the page is loaded, allows the user to just start typing without having to manually focus the main control.

datalist

optional

EL and literal

Id of <hx:datalist> for suggestions mechanism. By this way, suggestion options(datalist) can be shared across several input elements.

step

optional

String and number

Used for 'datetime', 'datetime-local' and 'time' types. Defines the accuracy of the selectable time (in seconds if no format is defined).
Formats can be applied with the rules at java.text.SimpleDateFormat. e.g. "1H":one hour, "10m":10 minutes, etc.
If it is not defined, 'any' will be rendered as the attr value; thus it is up to browser (opera uses 1 minute by default). Can be minimum:0.01

Notes: 
  • Cannot extend hx:inputText, since this doesn't have size, pattern, placeholder, etc. attributes! Will extend an abstract middle component.
  • Date range to select is driven by <fx:validateDateRange>
References:

<fx:validateDateRange>

Notes: 
  • This component will have the exact semantics with Trinidad's <tr:validateDateRange>. Since a dependency to Trinidad won't be good, I am planning this to be a copy of that component.
  • min/max attributes rendered by <hx:inputDateTime>'s renderer are driven by this validator. HTML5 allows us to set min/max dates that can be selected.
  • This validator will allow applications to validate the input on both server-side and client-side.
References:

Usage of prototypes:

usage: date
<hx:inputDateTime value="#{someBean.someField}" type="date" >
	<fx:validateDateRange min="2000-03-24" max="2010-03-24" />
</hx:inputDateTime>
expected HTML5 code
<input type="date" min="2000-03-24" max="2010-03-24" />



usage datetime and step
<hx:inputDateTime value="#{someBean.petBirthMoment}" type="datetime" step="10">
	<fx:validateDateRange min="#{someBean.sevenYearsAgo}" max="#{someBean.now}" />
</hx:inputDateTime>
expected HTML5 code
<input type="datetime" value="" min="2000-03-24T12:02Z" max="2010-03-24T12:02Z" step="10" />



usage: type month with no restrictions
<hx:inputDateTime value="#{someBean.someMonth}" type="month" />
expected HTML5 code
<input type="month"/>
  • No labels