OverviewSince 2.0 The dateTimeEntry component allows you to enter a date and/or a time. You can enter the date/time as text or pick the date/time from an inline or popup calendar. When entering as text, the format is as specified in the pattern attribute.
Getting Started<ace:dateTimeEntry id="cal" value="#{datePopup.selectedDate}" timeZone="Canada/Mountain" pattern="MMM/dd/yyyy" renderAsPopup="true"/> Attributes
value is value of the component as a java.util.Date object. Default is current date and time. renderAsPopup determines whether the calendar is displayed inline or as a popup. Default is false, i.e. inline. The pattern attribute is used to specify the date/time format of the text input field. It also affects whether the time entry sliders appear in the calendar. The pattern characters are as detailed in the java.text.SimpleDateFormat javadoc. When an hour field is present in the pattern, the time entry sliders will appear. Some uncommon pattern characters (e.g. G, w, K, k) may not be translatable to pattern characters for the client side date/time object. The following pattern characters are supported: y, M, d, E, a, H, h, m, s, z. But even with these supported pattern characters the formatting may not be exactly the same on the server side and client side. E.g.:
timeZone is used to set the date's time zone. It can be a string or java.util.TimeZone object. Month/year navigation is by left and right arrow images, one month at a time. To also navigate by month/year drop down lists, set navigator to true. To enter time only, set timeOnly to true. Multiple months can be displayed by specifying the no. of months in pages. Event Listeners
Client Behavior Events
JavaScript APIICEfaces 3.xThe client side component object is exposed through the global variable name specified in the widgetVar attribute. ICEfaces 4+The "widgetVar" attribute on the ACE components has been removed in ICEfaces 4 and in its place a new "ice.ace.instance()" client JavaScript object lookup API has been introduced. The reason for this change is to enable lazy-initialization of the ACE component JavaScript objects to improve runtime performance and reduce browser memory use. var widget = ice.ace.instance('frm:componentId);
Keyboard and ARIA SupportThese keyboard shortcuts work only in a popup calendar without the time component. Some of them may conflict with browser keyboard shortcuts.
The following ARIA roles are supported: grid, presentation, heading, columnheader, gridcell, textbox. LabelsThis component supports built-in labels. The text specified in the label attribute will be rendered next to the main input field of this component. The position specified by labelPosition will determine where this label is going to be rendered; the possible values are left, right, top, bottom, none and inField (to render the label in the field itself). Required IndicatorThe requiredIndicator attribute specifies the text to be displayed next to the main input field when this component is marked as required. When, this component is not marked as required, then the text specified in the optionalIndicator is going to be rendered. The indicatorPosition attribute determines where this indicator text is going to the rendered; the possible values are left, right, top, bottom, labelLeft, labelRight, and none. Required StylingThen this component is marked as required, the main input field receives the CSS class ui-state-required, otherwise, it receives the CSS class ui-state-optional. When this component is marked as invalid by the app, it will be rendered with the CSS class ui-state-error. These CSS classes can be used to add custom styling to this component, in order indicate its current state in a more visual way. CSS ClassesThe following markup represents the basic HTML structure of the component and the CSS classes it uses. <!-- Root container --> <span class="[user defined classes]" style="[user defined styles]"> <div> <div class="ui-datepicker-inline ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"> <div class="ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-all"> <!-- Previous month button --> <a class="ui-datepicker-prev ui-corner-all"> <span class="ui-icon ui-icon-circle-triangle-w">Prev</span> </a> <!-- Next month button --> <a class="ui-datepicker-next ui-corner-all"> <span class="ui-icon ui-icon-circle-triangle-e">Next</span> </a> <!-- Current month and year --> <div class="ui-datepicker-title"> <span class="ui-datepicker-month">Month</span> <span class="ui-datepicker-year">20??</span> </div> </div> <table class="ui-datepicker-calendar"> <thead> <tr> <!-- The first day of the week --> <th class="ui-datepicker-week-end" role="columnheader"> <span title="Sunday">Sun</span> </th> <!-- ...the rest of the days of the week go here --> </tr> </thead> <tbody> <!-- The first row of days of the month --> <tr> <!-- The first day of the month --> <td class="ui-datepicker-week-end"> <a class="ui-state-default">1</a> </td> <!-- ...the rest of the days of the month in the first row go here --> </tr> <!-- ...the rest of the rows of days of the month go here --> </tbody> </table> </div> </div> </span> Lenient ParsingThe lenientParsing attribute is turned on by default and it enables the lenient mode of java.text.DateFormat when converting inputs to Date objects. It is also turned on by default in java.text.DateFormat. When this is enabled, the user can enter out-of-range values and the input will still be parsed successfully (i.e. there won't be a ParseException). However, the results might be quite different from what's expected. The following example is taken from the java.util.Calendar javadoc.
Known IssuesNone. Additional ResourcesTutorial on setting locale |
DateTimeEntry
© Copyright 2021 ICEsoft Technologies Canada Corp.