Jakarta > Tapestry
Jakarta
 
Font size:      

DatePicker

Provides a form Date field component for selecting dates. DatePicker presents a drop down monthly calendar for users to select dates from.

JavaScript must be enabled in the client browser to use the drop down calendar. If JavaScript is not enabled users can still enter a date value in the HTML text field.

Note a rendering feature of Netscape and Internet Explorer gives the HTML <select> element the highest Z-level index. The HTML <select> cannot be covered by other elements. If a <select> is located inside the DatePicker's popup calendar region, the <select> will render through the popup calendar obscuring part of the calendar. In these situation organize the form's UI layout so this does not occur.

See also:Button, Form

Parameters

Name Type Direction Required Default Description
value java.util.Date in yes   The data value. Take care to ensure date time values are 'normalized' before performing any millisec based comparison or equality operations.
format String in no dd MMM yyyy The date format string. See SimpleDateFormat for format pattern letters.
disabled boolean in no false Controls whether the date field and calendar button is active or not.
icon IAsset in no   The icon used to toggle the calendar on and off. The calendar will automatically line itself up beneath the text input field.

Body: removed

Informal parameters: allowed (These parameters will be applied to the text field)

Reserved parameters: none

Examples

This example provides a simple form where the user can select a start date and an end date.

HTML template

<form jwcid="Form" listener="listener:formSubmit">
<table valign="middle">
 <tr>
  <td>Start Date:</td> <td><span jwcid="@DatePicker" value="ognl:startDate"/></td>
 </tr>
 <tr>
  <td>End Date:</td> <td><span jwcid="@DatePicker" value="ognl:endDate"/></td>
 </tr>
 <tr>
  <td colspan="2">&nbsp;</td>
 </tr>
 <tr>
  <td colspan="2" align="right"><input type="submit" value="Submit"/></td>
 </tr>
</table>
</form>

Page specification

...
<property name="startDate" type="java.util.Date"/>
<property name="endDate" type="java.util.Date"/>
...

Java source

public abstract class Dates extends BasePage {
    public abstract Date getStartDate();

    public abstract Date getEndDate();

    public void formSubmit(IRequestCycle cycle) {
        // Process the submitted dates.
    }
}