Using Dates in Enterprise Forms
DateField in CMS form editor
When editing a form in the CMS, a field type called "Date Field" is available. It contains the following settings:
- Initial value: is the initial value of the date field. Note that the actual values presented to a site visitor depends on site implementation. Choice of:
- Empty: no value presents
- Specific date: set a particular date
- Offset from "today": support for calculating a date value as a term from the dayof visiting the page
- Rule: an implemented initial value rule, please see page Custom Date Field Initial Value Rule.
- Date format: is the format pattern used for specifying and validating a date. When left empty, a default date format is used as detailed below. The following formats are supported:
As of version 3.0.1, a time pattern of ' HH:mm' (separated from the date format using a space character) may be appended, causing the CMS to enforce a time in addition to the date.
Customize default date format in CMS
A new date field uses the default format pattern MM/dd/yyyy. It is possible to change this default format pattern via the following configuration:
- In the console mode, open the node of type frontend:plugin:
- Add or edit the property dateformat with your custom format pattern (e.g. dd/MMM/yyyy). For other patterns, please see Java Date Format Patterns.
In the site part, date field is supported by com.onehippo.cms7.eforms.hst.model.DateField
The Initial value and Date format for the field can be retrieved from the bean, any logic or defaults for initial values is supported.