A script-enabled browser is required for this page to function properly.

About Validation

Oracle Forms validates an item by ensuring that the item conforms to the rules that pertain to it. Triggers can implement additional validation.

Validation unit

A form's Validation Unit property controls the granularity of validation in the form. The validation unit can be an item, record, block, or form. Most Oracle Forms applications validate at the item level.

When validation occurs

Oracle Forms performs validation when:

Oracle Forms does not perform validation in Enter Query mode. This allows the end user to enter query criteria that Oracle Forms would find invalid.

How validation proceeds

Internally, Oracle Forms maintains a status for each item, record, block, and form. For purposes of validation, each potential validation unit has a validation status with one of two values:

The Valid status means that Oracle Forms does not need to examine the validation unit. The Unvalidated status, a combination of states known internally as New and Changed, means that Oracle Forms needs to validate the items in the validation unit. The distinction between New and Changed appears only rarely in the validation process (see the note in the Record entry in the table that follows).

A third state occurs if validation fails, but in that case Oracle Forms does not proceed until the situation is corrected, so the failed status does not enter into the validation process.

Oracle Forms validates a validation unit according to one of the following processes:

Item

If the item's status is Valid, the process stops. If the status is Unvalidated, Oracle Forms performs standard validation checks, then fires the WHEN-VALIDATE-ITEM trigger. (See, however, the Defer Required Enforcement property.)

Record

If the record's status is Valid, the process stops. If the status is Unvalidated, Oracle Forms validates each item in the record, then fires the WHEN-VALIDATE-RECORD trigger.

Note: if the validation is as a result of a call to the VALIDATE trigger and the record's internal status is New, the process stops.

Block

Oracle Forms validates all records in the block.

Form

Oracle Forms validates all blocks in the form.

Item validation status

Unvalidated Oracle Forms sets the status of an item to Unvalidated when any of the following occurs:

Note: Oracle Forms sets the status of the item to Unvalidated even if the new value is the same as the old value. For example, if an item with Valid status has the value 10 and the end user types 10 into the item, Oracle Forms sets the status of the item to Unvalidated.

Caution: This behavior avoids validation loops, but a trigger error can cause Oracle Forms to commit an invalid value to the database.

Record validation status

Each record has a validation status of Unvalidated or Valid.

Note: a record's validation status is not equivalent to the value of the SYSTEM.RECORD_STATUS system variable.

Unvalidated Oracle Forms sets the status of a record to Unvalidated in the following cases:

Note: See Changing Data During Commit Processing for exceptions to this rule.

Standard validation checks

Oracle Forms uses the requirements specified in the Data and List of Values (LOV) sections of the property palette to validate an item.

Validation sequence for text items

For text items, Oracle Forms performs one of the following sequences of validation steps, depending on whether the item’s value is null or not-null. If the text item fails a validation step, Oracle Forms notes the failure and omits the subsequent validation steps.

When the item’s value is null:

  1. If the item's Required property has a setting of Yes, the item fails validation -- unless item-level validation is occurring and one of the following is true:

  2. If the item's Required property has a setting of No, then the WHEN-VALIDATE-ITEM trigger is fired. If the trigger raises the Form_Trigger_Failure exception, the item fails this validation step.

When the item’s value is not null:

  1. Check data type. If the value does not match the item's data type, the item fails this validation step.
    Oracle Forms tries to convert a user-entered value to the item's data type.
    If the item has a format mask, Oracle Forms uses it. If the item has no format mask and its data type is DATE or DATETIME, Oracle Forms uses the input format mask derived at Oracle Forms startup.
    If the item has no format mask and is of data type NUMBER or ALPHA, Oracle Forms checks for a valid numeric or alphabetic text string.
  2. Check range. If the value does not match the item's Lowest Allowed Value and Highest Allowed Value properties, the item fails this validation step.
  3. If the item's Use LOV for Validation property has the value Yes, verify that the value appears in the item's List of values.
  4. Fire the POST-CHANGE trigger. If the trigger raises the Form_Trigger_Failure exception, the item fails this validation step.
  5. Fire the WHEN-VALIDATE-ITEM trigger. If the trigger raises the Form_Trigger_Failure exception, the item fails this validation step.

Validation sequence for non-text items

If the item's Item Type property does not have the value Text Item, Oracle Forms follows the above sequence, but omits steps 3 through 5. It also omits step 2 unless the Item Type property has the value List Item and the List Style property has the value Combo Box.

Validation of synchronized items

If items, say B and C, have their Synchronize with Item properties set to the name of another item, say A, then A, B, and C form a set of synchronized items. A is the master item of the set, and B and C are subordinate items. Synchronized items were called mirror items in earlier versions of Oracle Forms.

The items of a synchronized set share a common data value, but can have different item properties. Oracle Forms takes data-specific properties and triggers from the master item and ignores those properties and triggers for the subordinate items.

When validating the value assigned to a synchronized set of items, Oracle Forms uses the following data-specific properties and triggers from the master item:

If the subordinate item has values for these properties or specifications for these triggers, Oracle Forms ignores them and issues a warning.

Oracle Forms takes the remaining validation properties from the item through which the data value is set—either programmatically or by end user action. In particular, Oracle Forms uses the Validate from List property of that item.

The SYSTEM.TRIGGER_ITEM variable contains the name of the item through which the data value was set. This allows code in the POST-CHANGE or WHEN-VALIDATE-ITEM trigger to refer to properties of that item, even though these triggers are defined for the master item.

Oracle Forms considers a value that has not been set programmatically or by the end user to have been set by the master item, because that is the source Oracle Forms uses for the initial value.

During record-level validation, Oracle Forms validates the item through which the data value was set. If validation fails, Oracle Forms gives focus to that item, unless the item instance does not allow end user input. In that case, Oracle Forms tries to give focus to another item of the synchronized set that does allow end user input. If it fails to find one, it tries to give focus to an item of the set for which the Enabled property has the value Yes.