Form field initialization can be controlled by the WITHOUT DEFAULTS dialog option.
The INPUT and INPUT ARRAY dialogs provide the WITHOUT DEFAULTS option to use program variable values when the dialog starts, or to apply the DEFAULT attribute defined in forms. The semantics of this options is slightly different in INPUT and INPUT ARRAY dialogs. The WITHOUT DEFAULTS clause should always be used in INPUT ARRAY.
The WITHOUT DEFAULTS option can be used in the binding clause or as an ATTRIBUTES. When used in the binding clause, the option is defined statically at compile time as TRUE. When used as an ATTRIBUTES option, it can be specified with an integer expression that is evaluated when the DIALOG interactive instruction starts:
INPUT BY NAME p_cust.* ATTRIBUTES (WITHOUT DEFAULTS = NOT new) ... END INPUT
In the default mode, an INPUT clears the program variables and assigns the values defined by the DEFAULT attribute in the form file (or indirectly, the default value defined in the database schema files). This mode is typically used to input and INSERT a new record in the database. The REQUIRED field attributes are checked to make sure that the user has entered all data that is mandatory. Note that REQUIRED only forces the user to enter the field, and can leave the value NULL unless the NOT NULL attribute is used. Therefore, if you have an AFTER FIELD or ON CHANGE control block with validation rules, you can use the REQUIRED attribute to force the user to enter the field and trigger that block.
In contrast, the WITHOUT DEFAULTS option starts the INPUT dialog with the existing values of program variables. This mode is typically used in order to UPDATE an existing database row. Existing values are considered valid, thus the REQUIRED attributes are ignored when this option is used.
The NOT NULL field attribute is always checked at dialog validation, even if the WITHOUT DEFAULTS option is set.
With an INPUT ARRAY, the WITHOUT DEFAULT option defines whether the program array is populated when the dialog begins. Once the dialog is started, existing rows are always handled as records to be updated in the database (i.e. WITHOUT DEFAULTS=TRUE), while newly created rows are handled as records to be inserted in the database (i.e. WITHOUT DEFAULTS=FALSE). In other words, column default values defined in the form specification file or the database schema files are only used for new created rows.