The calendar form field type provides a text box for entry of a date. An icon next to the text box provides a link to a pop-up calendar, which can also be used to enter the date value. If the field has a saved value this is shown in the text box. Otherwise the default value, if any, is displayed.

Example XML Field Definition:

<field name="mycalendar" 
type="calendar"
default="2017-09-15"
label="Select a date"
description=""
class="input-small"
required="true"
filter="user_utc"
showtime="false"
todaybutton="false"
filltable="false"
translateformat="true" />

Mandatory Parameters

  • type - must be calendar.

  • name - is the unique name of the field.

  • label - (translatable) is the descriptive title of the field.

Optional Parameters

  • default is the default date. You can put "NOW" to have current date or time information in the given format.

  • description (translatable) is text that will be shown as a tool tip when the user moves the mouse over the text box.

  • readonly is whether the text box is read-only (true or false). If the text box is read-only, the date cannot be changed, but can be selected and copied. No calendar icon will be shown.

  • disabled is whether the text box is disabled (true or false). If the text box is disabled, the date cannot be changed, selected or copied.

  • class is a CSS class name for the HTML form field.

  • format is the date format to be used. This is in the format used by PHP to specify date string formats. If no format argument is given, '%Y-%m-%d' is assumed.

  • filter is time zone to be used. There are two values; server_utc and user_utc. The first one is server time zone and the later is user time zone as configured in global configuration and user information respectively.

  • translateformat: If set to true, the calendar will use a language string to determine the format. The `format` attribute is ignored. If false, the `format` attribute is used (same behaviour as today).

  • showtime: If set to true and translateformat is true, the language key DATE_FORMAT_CALENDAR_DATETIME is used, otherwise DATE_FORMAT_CALENDAR_DATE. 

  • timeformat: can be set to 12 (and specify AM or PM) or 24

  • singleheader: if set to false, the year and the month selection will be set on two separates lines, with independent selection

  • todaybutton: if set to true, a button is added at the bottom of the datePicker to select the date of the current day

  • weeknumbers: if set to true, a column is added at the left of the datePicker to display the number of the week in the current year

  • filltable: if set to true, dates of the previous and next month is added at the top and the bottom of the current month to fill the grid

  • minyear: set a signed integer for a number of years (-10, -2, 0, 7, 12, ...) to define the relative lower limit for the year selection. The user could not select a year before your limit

  • maxyear: set a signed integer for a number of years (-10, -2, 0, 7, 12, ...) to define the relative upper limit for the year selection. The user could not select a year after your limit