Oracle Forms provides developers with a powerful way to build interactive and dynamic applications. Often, you need to change how items (such as text fields, checkboxes, or buttons) behave depending on user actions, data values, or business rules. This is achieved by modifying properties at runtime.
In this article, we will explore how to Change Item Properties at Runtime in Oracle Forms, discuss the built-ins available, provide practical examples, and highlight best practices for creating responsive forms.
What Are Item Properties in Oracle Forms?
Item properties define how an element (text item, checkbox, radio button, etc.) looks and behaves. Some examples include:
- Enabled/Disabled – Controls whether the user can interact with the item.
- Visible/Hidden – Determines if the item is displayed on the canvas.
- Prompt Text – The label that appears next to an item.
- Required – Forces users to enter a value before saving.
- Visual Attribute – Controls colors, fonts, and styles.
Changing these properties dynamically allows your application to react to user actions in real time.
Built-ins for Changing Item Properties
Oracle Forms provides two main built-ins for runtime property changes:
- SET_ITEM_PROPERTY
- Used to change the properties of items at the block level.
- Example properties:
ENABLED,VISIBLE,REQUIRED,PROMPT_TEXT,VISUAL_ATTRIBUTE.
- SET_ITEM_INSTANCE_PROPERTY
- Used to change properties for specific records in a multi-record block.
- Example properties:
VISUAL_ATTRIBUTE,UPDATE_ALLOWED,NAVIGABLE.
Using SET_ITEM_PROPERTY
The SET_ITEM_PROPERTY built-in changes a property for an item across all records in a block.
Syntax:
SET_ITEM_PROPERTY(item_name, property, value);
Example 1: Enable or Disable an Item
BEGIN
SET_ITEM_PROPERTY('EMP_BLOCK.SALARY', ENABLED, PROPERTY_FALSE);
END;
- Disables the
SALARYfield for all records in the block.
To re-enable:
BEGIN
SET_ITEM_PROPERTY('EMP_BLOCK.SALARY', ENABLED, PROPERTY_TRUE);
END;
Example 2: Change Prompt Text at Runtime
BEGIN
SET_ITEM_PROPERTY('EMP_BLOCK.SALARY', PROMPT_TEXT, 'Monthly Salary');
END;
- Updates the label of the
SALARYitem to “Monthly Salary”.
Example 3: Hide or Show an Item
BEGIN
SET_ITEM_PROPERTY('EMP_BLOCK.BONUS', VISIBLE, PROPERTY_FALSE);
END;
- Hides the
BONUSfield completely from the form.
Using SET_ITEM_INSTANCE_PROPERTY
When working with multi-record blocks, sometimes you only want to change properties for a single record instead of all records. This is where SET_ITEM_INSTANCE_PROPERTY comes in.
Syntax:
SET_ITEM_INSTANCE_PROPERTY(item_name, instance, property, value);
Example 1: Change Visual Attribute for Current Record
BEGIN
SET_ITEM_INSTANCE_PROPERTY('EMP_BLOCK.SALARY', CURRENT_RECORD, VISUAL_ATTRIBUTE, 'VA_HIGHLIGHT');
END;
- Highlights the salary field of the current record using a predefined visual attribute (
VA_HIGHLIGHT).
Example 2: Make a Field Non-Navigable for Specific Record
BEGIN
SET_ITEM_INSTANCE_PROPERTY('EMP_BLOCK.COMMISSION', CURRENT_RECORD, NAVIGABLE, PROPERTY_FALSE);
END;
- Prevents navigation into the
COMMISSIONitem in the current record only.
Practical Use Cases
- Dynamic Form Behavior
- Hide or disable fields based on user roles.
- Example: Managers can update salaries, but clerks cannot.
- Conditional Formatting
- Highlight records that meet certain criteria.
- Example: Salaries above 10,000 displayed in bold red.
- User Guidance
- Change prompts or display messages depending on input.
- Example: Change field prompt from “Discount” to “Special Discount” if customer type = VIP.
- Validation Assistance
- Mark invalid fields with a different background color.
- Example: Change visual attribute if an entered value is out of range.
Commonly Used Properties with SET_ITEM_PROPERTY
| Property | Value Options | Description |
|---|---|---|
| ENABLED | PROPERTY_TRUE/FALSE | Enable or disable input |
| VISIBLE | PROPERTY_TRUE/FALSE | Show or hide the item |
| REQUIRED | PROPERTY_TRUE/FALSE | Make input mandatory |
| PROMPT_TEXT | String value | Change the label of the field |
| VISUAL_ATTRIBUTE | Visual Attribute name | Apply colors, fonts, and styles |
| UPDATE_ALLOWED | PROPERTY_TRUE/FALSE | Control update permissions |
Best Practices for Runtime Property Changes
- Plan attributes in advance: Define visual attributes in Object Navigator for consistency.
- Avoid overuse: Too many runtime changes can confuse users.
- Combine with triggers: Use triggers like
WHEN-NEW-RECORD-INSTANCEorWHEN-VALIDATE-ITEMfor dynamic control. - Test for performance: Excessive property changes in multi-record blocks can slow down navigation.
- Maintain consistency: Ensure that users clearly understand which fields are editable and why.
Common Errors to Watch Out For
- FRM-41009: Function cannot be performed here
- Happens if you try to change a property inside an invalid trigger.
- FRM-41084: Error during SET_ITEM_PROPERTY
- Usually caused by referencing a wrong item name or using an invalid property.
- Inconsistent UI
- Forgetting to reset properties when conditions change may leave items in the wrong state.
Conclusion
Being able to Change Item Properties at Runtime in Oracle Forms allows developers to create highly dynamic, responsive, and user-friendly applications. By using built-ins like SET_ITEM_PROPERTY and SET_ITEM_INSTANCE_PROPERTY, you can control visibility, accessibility, prompts, and formatting of items based on user roles, conditions, or business rules.
When applied carefully with best practices, this feature enhances usability and ensures that your Oracle Forms applications remain flexible and intuitive.

