?
Solved

Oracle Forms pop-up Error Messages.

Posted on 2003-02-27
8
Medium Priority
?
9,530 Views
Last Modified: 2009-10-16
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
Comment
Question by:stuart_s
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 

Expert Comment

by:camposaa
ID: 8036242
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
 
LVL 5

Expert Comment

by:jpkemp
ID: 8039464
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
 
LVL 22

Expert Comment

by:Helena Marková
ID: 8039775
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
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 5

Expert Comment

by:FBIAGENT
ID: 8044175
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
 

Author Comment

by:stuart_s
ID: 8058505
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
 
LVL 5

Accepted Solution

by:
jpkemp earned 150 total points
ID: 8061315
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
 
LVL 5

Expert Comment

by:jpkemp
ID: 8061320
Whoops, cut-and-paste error: "END show_error;" should be "END confirm;"

Jeff
0
 

Author Comment

by:stuart_s
ID: 8064040
Hi jpkemp, Thanks for you assitance.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question