• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 11888
  • Last Modified:

Oracle Forms pop-up Error Messages.

With Forms, error messages are displayed on the message bar at the base of the form. Is there a way to get the error message such as, when in-valid data is entered, to be displayed in a pop-up box? and also personalise the displayed message.

If so, how?
0
stuart_s
Asked:
stuart_s
1 Solution
 
camposaaCommented:
Try something like this:


/*  

** Built-in:  CLEAR_MESSAGE
** Example:   Clear the message from the message line.
*/
BEGIN
  Message('Working...',No_Acknowledge);
  SELECT current_tax
    INTO :Emp.Tax_Rate
    FROM tax_table
   WHERE state_abbrev = :Emp.State;
  Clear_Message;
END;
0
 
jpkempCommented:
We use alerts.

Create an alert, e.g. ERROR_ALERT, and then in your code have something like:

PROCEDURE show_error (p_msg IN VARCHAR2) IS
  v_dummy NUMBER;
BEGIN
  SET_ALERT_PROPERTY('ERROR_ALERT', TITLE, 'Error');
  SET_ALERT_PROPERTY('ERROR_ALERT', ALERT_MESSAGE_TEXT, p_msg);
  v_dummy := show_alert('ERROR_ALERT');
END show_error;

The properties of ERROR_ALERT would be something like:

Alert Style = Stop
Button 1 Label = Ok
Button 2 Label =
(buttons 2 and 3 labels should be blank)

Jeff
0
 
Helena Markováprogrammer-analystCommented:
I use also alerts. But you can also use one of these:

message('This is my message');
pause;

or

message('This is my message');
message('This is my message');

In both cases a message will be displayed in a popup window, too.

Henka
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
FBIAGENTCommented:
STUART,

Just an addition to those posted above, your form will have to have either a form-level or block-level ON-ERROR trigger to catch all run-time errors generated by forms and output those error messages via alerts as those posted above.

good luck
0
 
stuart_sAuthor Commented:
Hi, Most of my messages will only need a confirmation or a cancel action & therefore whats the best way to create a pop-up message that, if the user presses ok that action is carried out, i.e. Commit, Delete & if the user presses the cancel button the action is cancelled?  Please bear in mind that i an a novice & therefore also, where & what type of trigger would be required?

Many thanks,
0
 
jpkempCommented:
For a confirmation/cancel message I would create another alert, e.g. CONFIRM_ALERT, and then in your code have something like:

FUNCTION confirm (p_msg IN VARCHAR2) RETURN BOOLEAN IS
 v_btn NUMBER;
BEGIN
 SET_ALERT_PROPERTY('CONFIRM_ALERT', TITLE, 'Please confirm');
 SET_ALERT_PROPERTY('CONFIRM_ALERT', ALERT_MESSAGE_TEXT, p_msg);
 v_btn := show_alert('CONFIRM_ALERT');
 RETURN v_btn = ALERT_BUTTON1;
END show_error;

SHOW_ALERT returns ALERT_BUTTON1 if button 1 is pressed, ALERT_BUTTON2 if button 2 is pressed, or ALERT_BUTTON3 if button 3 is pressed. In this case, I set up CONFIRM_ALERT to only have two buttons (Ok and Cancel).

I return "v_btn = ALERT_BUTTON1" so that the function returns TRUE if the user pressed the Ok button, and FALSE otherwise.

The properties of CONFIRM_ALERT would be something like:

Alert Style = Stop
Button 1 Label = Ok
Button 2 Label = Cancel
(button 3 label should be blank)

Jeff
0
 
jpkempCommented:
Whoops, cut-and-paste error: "END show_error;" should be "END confirm;"

Jeff
0
 
stuart_sAuthor Commented:
Hi jpkemp, Thanks for you assitance.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now