How to Create Alerts in Oracle Forms?

How to Create Alerts in Oracle Forms?

In Oracle Forms, Alerts are used to give a message to the user at runtime. We can create three types of Alerts in Oracle Forms. These three types are information message, a warning or error, and a confirmation message. In this tutorial, you will learn how to create Alerts in Oracle Forms.

Create Alert to Give Information or Warning Message with Single Button

Follow these steps.

  1. In Oracle Form's Object Navigator, click on the Alerts node and then click on the + icon to create a new Alert.
  2. Then do the right click on it and select Property Palette option.
  3. The Property Palette window will open. There change the following properties to create an Information or warning message alert.
  • Name: INFO_ALERT
  • Title: Information
  • Message: You logged in Successfully.
  • Alert Style: Select Note (if information message), select Stop (if error message) or Caution for the warning message.
  • Button Label 1: OK (leave button label 2 and 3 will be blank because this is just a message alert, so we need single button only).
  • Default Alert Button: Button 1

create alert in Oracle Forms

Then close the Property Palette window. Now your information message alert has been created. You can use it as shown in the example below.

Declare
n number;
Begin
n := show_alert('info_alert');
end;

You can also set the alert message property at runtime, with set_alert_property command. Below is an example.

Declare
n number;
Begin
set_alert_property('info_alert', alert_message_text, 'Your password will expire in 3 days.');
n := show_alert('info_alert');
end;

Create Alert to Ask For a Confirmation From The User with Yes/No Button

Follow these steps.

  1. In Oracle Form's Object Navigator, click on the Alerts node and then click on the + icon to create a new Alert.
  2. Then do the right click on it and select Property Palette option.
  3. The Property Palette window will open. There change the following properties to create a confirmation message alert.
  • Name: ASK_ALERT (give any name)
  • Title: Confirm?
  • Message: Are you sure to delete the record(s)?
  • Alert Style: Caution
  • Button Label 1: Yes
  • Button Label 2: No
  • Default Alert Button: Button 2 (which is set to No)

confirmation alert in Oracle forms.

Confirmation Alert created. Close the Property Palette window and use it as shown in the example below.

Declare
n number;
Begin
n := show_alert('ask_alert');

if n = alert_button1 then -- if user selected yes
Delete_record;
end if;

end;

See also:

  • Using Single Alert for All types of Messages in Oracle Forms
  • Display Modal Window Messages In Oracle Forms

This Post Has 3 Comments

  1. Fer

    thanks a lot, it was very usesfully 🙂

  2. Kom

    Hi,
    what is the meaning of cross mark on any property instead of green?is it means that that particular property is not working?

  3. MW

    Hi....Any way to display a query output in the alert? I just want to know how to display data from a table (say 10-20 rows) in an alert

Comments are closed.