A component used to collect a provided date/time from the user using a client-side JavaScript calendar. Non-JavaScript clients can simply type into a text field.
| Name | Type | Flags | Default | Default Prefix | Description |
|---|---|---|---|---|---|
| afterUpdateElement | String | NOT Allow Null | literal | a named javascript function, that executed after the date selected by the picker. there should one function parameter that holds the input dom element. This funtion should returns true or false. | |
| datePattern | String | NOT Allow Null | MM/dd/yyyy | literal | the pattern describing the date and time format java.text.SimpleDateFormat. |
| datePicker | boolean | NOT Allow Null | true | prop | a boolean value determining whether to display the date picker. Defaults to true. |
| icon | org.apache.tapestry5.Asset | NOT Allow Null | datetimefield/calendar.png | asset | |
| lenient | boolean | NOT Allow Null | true | prop | Specify whether or not date/time parsing is to be lenient. With lenient parsing, the parser may use heuristics to interpret inputs that do not precisely match this object's format. With strict parsing, inputs must match this object's format. |
| timePicker | boolean | NOT Allow Null | false | prop | a boolean value determining whether to display the time picker. Defaults to false. |
| timePickerAdjacent | boolean | NOT Allow Null | false | prop | a boolean value determining whether to display the time picker next to the date picker (true) or under it (false, default). |
| use24hrs | boolean | NOT Allow Null | false | prop | a boolean value determining whether to display the time in AM/PM or 24 hour notation. Defaults to false. |
| validate | org.apache.tapestry5.FieldValidator | NOT Allow Null | validate | The object that will perform input validation (which occurs after translation). The translate binding prefix is generally used to provide this object in a declarative fashion. | |
| value | java.util.Date | Required, NOT Allow Null | prop | The value parameter of a DateField must be a java.util.Date. |
This example describe how to use the DateTimeField component.
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<body>
<h1>Hello Guys and Dolls</h1>
<form t:type="Form">
<input t:id="dateTimeField1"/>
<br/>
<input t:id="dateTimeField2"/>
<br/>
<input type="submit" id="submit"/>
</form>
</body>
</html>
public class MyPage
{
@Persist
@Property
private Date _actualDate1;
@Persist
@Property
private Date _actualDate2;
@Component(parameters = {"value=actualDate1", "datePattern=dd-MM-yyyy HH:mm", "timePicker=true", "timePickerAdjacent=true"})
private DateTimeField _dateTimeField1;
@Component(parameters = {"value=actualDate2"})
private DateTimeField _dateTimeField2;
void setupRender()
{
_actualDate1 = new Date();
_actualDate2 = new Date();
}
}