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.

DATEEDIT widget constraints

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. 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.
  • Date editors may not allow to specify NULL.
  • The widget may allow only strict year/month/day value input, and therefore cannot be used with a CONSTRUCT instruction, where it must be possible to enter search filters like ">=24/03/2014".
Tip: Consider testing your application form using DATEEDIT fields 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. 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.

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.

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.