DATEEDIT item type

Defines a line-edit with a calendar widget to pick a date.

DATEEDIT item basics

The DATEEDIT form item defines a field that can open a calendar to ease date input.

To store DATEEDIT field values, use a DATE program variable with this form item.

On desktop (GDC/GBC) and browser (GAS/GBC), the date value picker is generic and common to both front-end platforms. On mobile devices (GMA and GMI), when the dialog is an INPUT, the native date picker is used to edit the value. With a CONSTRUCT, the generic date picker is used to let the user enter a search criteria.

Defining a DATEEDIT

The DATEEDIT form item type allows the user to edit date values with a specific widget for date input. A DATEEDIT field typically provides a calendar widget, to let the end user pick a date from it.

When using a DATE variable as recommended, with desktop front-ends, the format of DATEEDIT fields is by default defined by the DBDATE environment variable. On mobile platforms, the date format is defined by the device OS language settings. It is recommended to use the same DBDATE setting as in the device settings.

Specific DATE format can be defined with the FORMAT attribute, but it is recommended to use the default date formatting.

Front-ends support different presentation and behavior options, which can be controlled by a STYLE attribute. For more details, see Style attributes common to all elements and DateEdit style attributes.

Depending on the front-end platform, the widget and time picker to render a DATEEDIT field may have the following limitations:
  • The front-end may deny data types different from DATE.
  • The date value picker/editor may not allow to specify NULL.

Detecting DATEEDIT calendar selection

To inform the dialog when a date is picked from the calendar widget, define an ON CHANGE block for the DATEEDIT field. The program can then react immediately to user changes in the field:

-- Form file (grid layout)
DATEEDIT de1 = order.ord_shipdate,
   NOT NULL;

-- Program file:
ON CHANGE ord_shipdate
   -- A new date value was picked from the calendar

For more details, see Reacting to field value changes.

Where to use a DATEEDIT

A DATEEDIT form item can be defined with an item tag and a DATEEDIT item definition in a GRID, SCROLLGRID and TABLE/TREE.

Defining the widget size

The size of a DATEEDIT widget is computed by following the layout rules as described in Widget width inside hbox tags.

Field input length

The input length in a DATEEDIT fields is defined by the (DATE) program variable. Define an item tag with 10 positions, to be able to display dates with 4 year digits. For more details, see Input length of form fields.

Calendar configuration

A set of presentation style attributes for the DateEdit class can be used to customize the calendar. For example, you can define the icons of the button to open the calendar, the days off, the first day of the week, and the type of pop-up window for the calendar.