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 the field value, use a DATE program variable with this form item.

Important: DATEEDIT fields are dedicated for DATE value input. Some front-ends (especially on mobile devices) deny data types different from DATE. If the front-end does not support the data type used for the DATEEDIT field, the runtime system will raise an error and stop the program. Consider testing your application with all types of front-ends.

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 as for other editor fields. Specific format can be defined with the FORMAT attribute, but it is recommended to use the default date formatting. On mobile platforms, the date format is defined by the device OS language settings.

On some front-end platforms, the native widget used for DATEEDIT fields allows only pure date value input, and therefore cannot be used with a CONSTRUCT instruction, where it must be possible to enter search filters like ">=24/03/2014".

Some front-ends support different presentation and behavior options, which can be controlled by a STYLE attribute. For more details, see Common style attributes and DateEdit style attributes.

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
   -- An 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 in two different ways:
  1. With an item tag and a DATEEDIT item definition in a grid-layout container (GRID, SCROLLGRID and TABLE).
  2. As a DATEEDIT stack item in a STACK container.

Defining the widget size

In a grid-based layout, the size of a DATEEDIT widget is computed according to layout rules as described in Widget size within hbox tags.

In a stack-based layout, the widget will take the full width available in the parent container.

Field input length

The input length in a DATEEDIT fields is defined by the (DATE) program variable. In a grid-based layout, define an item tag with 10 positions, to be able to display dates with 4 year digits. For more details, see Field input length.