How to Make a Field Mandatory in Oracle Forms?

How to Make a Field Mandatory in Oracle Forms?

In Oracle Forms, you can make a field mandatory at design time and at the runtime. Examples for both the methods are given below:

Make a Field Mandatory at Design Time in Oracle Forms

Whenever we create a form based on a table, then we already know that which field in that table is mandatory, means a field is having a primary key or having a not null constraint. So it is recommended to make that field mandatory in Oracle Forms at design time. Below are the steps:

  1. In Oracle Forms, right click on that field and choose Property Palette option.
  2. In Property Palette, set Required property to Yes in the Data section as shown in the below image:

Set a field mandatory in Oracle Forms.

Make a Field Mandatory at Runtime

You can make a field mandatory at runtime using the set_item_property built-in. In the below example, it will make the field ENAME mandatory in EMP block whenever a form activates.

When-New-Form-Instance Trigger

SET_ITEM_PROPERTY('EMP.ENAME', REQUIRED, PROPERTY_TRUE);

See also: