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:
    • yyyy/MM/dd
    • MM/dd/yyyy
    • dd/MM/yyyy​
    day, month and year can be separated using a space character, a dash '-', a dot '.' or a forward slash '/'. Typically, a front-end date picker widget is used and provisioned with a matching date format to help the user fill in the date form field. The Enterprise Forms demo project provides an example for this.
    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

This configuration is available from version 1.03.07

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:
/hippo:namespaces/eforms/form/editor:templates/_default_/form
  • 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.
If you need to have language specific formats, you can add dateformat_<language> properties for each language (e.g. dateformat_en, dateformat_nl,...)

The site

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.

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?