blob: bece8c6c9cc3ef05fcfa6e636f5a76afe56dd2d9 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2004, 2005 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document>
<properties>
<title>DatePicker</title>
</properties>
<body>
<section name="DatePicker">
<p>
Provides a form Date field component for selecting dates. DatePicker presents a drop
down monthly calendar for users to select dates from.
</p>
<p>
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.
</p>
<p>
Note a rendering feature of Netscape and Internet Explorer gives the HTML
<code>&lt;select&gt;</code> element the highest Z-level index. The HTML
<code>&lt;select&gt;</code> cannot be
covered by other elements. If a <code>&lt;select&gt;</code> is located inside the DatePicker's
popup calendar region, the <code>&lt;select&gt;</code> 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.
</p>
<p>
<strong>
See also:
<a href="button.html">Button</a>
,
<a href="form.html">Form</a>
</strong>
</p>
<section name="Parameters">
<table>
<tr>
<th>Name</th>
<th>Type</th>
<th>Required</th>
<th>Default</th>
<th>Description</th>
</tr>
<tr>
<td>value</td>
<td>java.util.Date</td>
<td>yes</td>
<td></td>
<td>
The data value. Take care to ensure date time values are 'normalized'
before performing any millisec based comparison or equality operations.
</td>
</tr>
<tr>
<td>disabled</td>
<td>boolean</td>
<td>no</td>
<td>false</td>
<td>
Controls whether the date field and calendar button is active or not.
</td>
</tr>
<tr>
<td>displayName</td>
<td>String</td>
<td>no</td>
<td></td>
<td>
The user-presentable name for the component, which will be used by a
<a href="fieldlabel.html">FieldLabel</a>
connected to the component.
</td>
</tr>
<tr>
<td>validators</td>
<td>
Array or collection of
<a
href="../../apidocs/org/apache/tapestry/form/validator/Validator.html">
Validator
</a>
</td>
<td>no</td>
<td></td>
<td>
The validators to apply to the component. Something along the lines of:
<code>validators:required</code> .<br/><br/>
<strong>See also:</strong> <a href="../../usersguide/validation.html">Validation</a>
</td>
</tr>
<tr>
<td>translator</td>
<td>
<a
href="../../tapestry/apidocs/org/apache/tapestry/form/translator/Translator.html">
Translator
</a>
</td>
<td>no</td>
<td>translator:date,pattern=dd MMM yyyy</td>
<td>
The translator to use when displaying and parsing the date.
<br/><br/>
<strong>See also:</strong> <a href="../../usersguide/validation.html">Validation</a>
</td>
</tr>
<tr>
<td>icon</td>
<td>
<a href="../../apidocs/org/apache/tapestry/IAsset.html">
IAsset
</a>
</td>
<td>no</td>
<td></td>
<td>
The icon used to toggle the calendar on and off. The calendar will
automatically line itself up beneath the text input field.
</td>
</tr>
<tr>
<td>id</td>
<td>String</td>
<td>no</td>
<td></td>
<td>Sets the id attribute for the rendered <code>&lt;input&gt;</code> element.</td>
</tr>
<tr>
<td>includeWeek</td>
<td>boolean</td>
<td>no</td>
<td></td>
<td>If true, displays in the calendar the week number for each week.</td>
</tr>
<tr>
<td>title</td>
<td>String</td>
<td>no</td>
<td>Localized String representing the expected format. (ie MM/DD/YYYY)</td>
<td>If not overriden the default title will be a localized pattern string representing
the currently accepted patterns.</td>
</tr>
<tr>
<td>imageClass</td>
<td>String</td>
<td>no</td>
<td>datePickerImg</td>
<td>
Specifies the css class name that will be applied to the DatePicker img icon reference.
</td>
</tr>
</table>
<p>
Body:
<strong>removed</strong>
</p>
<p>
Informal parameters:
<strong>allowed</strong>
(These parameters will be applied to the text field)
</p>
<p>
Reserved parameters:
<em>none</em>
</p>
</section>
<section name="Examples">
<p>
This example provides a simple form where the user can select a start date and
an end date.
</p>
<p>HTML template</p>
<source xml:space="preserve"><![CDATA[
<form jwcid="Form" listener="listener:formSubmit">
<table valign="middle">
<tr>
<td>Start Date:</td> <td><input jwcid="@DatePicker" value="ognl:startDate"/></td>
</tr>
<tr>
<td>End Date:</td> <td><input 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>
]]></source>
<p>Page specification</p>
<source xml:space="preserve"><![CDATA[
...
<property name="startDate" type="java.util.Date"/>
<property name="endDate" type="java.util.Date"/>
...
]]></source>
<p>Java source</p>
<source xml:space="preserve">
public abstract class Dates extends BasePage {
public abstract Date getStartDate();
public abstract Date getEndDate();
public void formSubmit(IRequestCycle cycle) {
// Process the submitted dates.
}
}
</source>
</section>
</section>
</body>
</document>