Adding a COMBOBOX form item
A combobox defines a dropdown box of values, allowing the user to select a value for the underlying formfield.
In this example application the only valid values for the state column of the database table
customer are IL
, IA
, and WI
. The form item used
to display the state field can be changed to a COMBOBOX
displaying a dropdown
list of valid state values. The combobox is active during an INPUT
,
INPUT ARRAY
, or CONSTRUCT
statement, allowing the user to select
a value for the state field.
The values of the list are defined by the ITEMS
attribute:
COMBOBOX f6=customer.state, ITEMS = ("IL", "IA", "WI");
In this example, the value displayed on the form and the real value (the value to be stored in
the program variable corresponding to the form field) are the same. You can choose to define different
display and real values; in this example, the values Paris
, Madrid
,
and London
would be displayed to the user, but the value stored in the corresponding
program variable would be 1
, 2
, or 3
:
COMBOBOX f9=order.ship_status, ITEMS = ((1,"New"),(2,"In Progress"),(3,"Delivered"));
INITIALIZER
attribute to define a function
that will provide the combobox items at runtime, typically by fetching the rows from the
corresponding SQL table. The initialization function would be invoked at runtime when the form is
displayed:COMBOBOX f9=customer.city, INITIALIZER = fill_city_items;