Home » Developer & Programmer » Forms » help on oracle form
help on oracle form [message #161378] Fri, 03 March 2006 11:07 Go to next message
ritchielin
Messages: 5
Registered: March 2006
Junior Member
I try to create a alert to display user enter wrong data type, saying, the field is set as data type number and user only allow to type in the number from 0-9, if user type in the different datatype, the alert will show up and tell user it is wrong data type!
thank you for help!
Re: help on oracle form [message #161431 is a reply to message #161378] Sat, 04 March 2006 00:55 Go to previous messageGo to next message
rleishman
Messages: 3728
Registered: October 2005
Location: Melbourne, Australia
Senior Member
First, welcome to OraFAQ.

Second, this one probably would have done better in the Forms forum.

[Rant]
And finally, you paid thousands of dollars for a product that does its own type checking, and you want to program all of the type-checking yourself so that you can give messages that are friendlier than Oracle's? Perhaps you should be using COBOLinstead...

Seriously though, I'm just winding you up. It's an easy trap for young players. I know this because I did it myself (not recently - I'm not telling you when it was, but I blame my brief loss of sense on all the hair gel and shoulder pads).

Seriously, seriously now - here comes the advice (about time). Oracle client tools (forms, reports, discoverer, SQL*Plus, Warehouse Builder,...) all include some fantastic features - many with no equivaent in their competitors. But they also have their downfalls - stuff we don't like about them.
What this means is that there are two ways to write Oracle software: the easy way and the hard way. For Forms, the easy way is using query techniques, commit handling, page handling, lookups, and error-handling provided or recommended by Oracle. The hard way is trying to make it look like it was written in some other language.
This means that when you get a specification from some know-all .Net developer, send it back and tell them that's not how you do it with Oracle.
[/Rant]


_____________
Ross Leishman
Re: help on oracle form [message #161707 is a reply to message #161431] Mon, 06 March 2006 18:02 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Agreed - tell them to tell you WHAT they want done NOT how you are to do it. Just tell them that each modified error message will cost US$500. Only user errors are included in the quoted price.

David
Re: help on oracle form [message #161872 is a reply to message #161707] Tue, 07 March 2006 10:41 Go to previous messageGo to next message
ritchielin
Messages: 5
Registered: March 2006
Junior Member
thank you for yr opinion, think about it!
Re: help on oracle form [message #161883 is a reply to message #161378] Tue, 07 March 2006 13:03 Go to previous message
M0nst3r
Messages: 38
Registered: February 2006
Location: Wherever the Money Is
Member
Oracle Forms already displays an error message when a user enters an invalid data type in a text item with the data type property set to 'Number'.

If you insist on showing the error in an alert instead of a message, you can do the following:

1. create an alert named 'STOP_ALERT'
2. create a form-level On-Error trigger with this code:
DECLARE
  lal_alert  ALERT;  -- alert id
  lnm_alert  NUMBER;  -- alert response
	
BEGIN
  lal_alert := FIND_ALERT('STOP_ALERT');

  -- FRM-50016:  Legal characters are 0-9 - + E .
  IF (ERROR_CODE = '50016') THEN
    SET_ALERT_PROPERTY(lal_alert, TITLE, 'Invalid Datatype');
    SET_ALERT_PROPERTY(lal_alert, ALERT_MESSAGE_TEXT, 'FRM-'||ERROR_CODE||': '||ERROR_TEXT);

    lnm_alert := SHOW_ALERT(lal_alert);

  -- Default error message for all other errors
  ELSE
    MESSAGE('FRM-'||ERROR_CODE||': '||ERROR_TEXT, NO_ACKNOWLEDGE);
  END IF;
END;

Adjust the code according to your needs.
Previous Topic: FRM-40735
Next Topic: hlep on oracle form alert
Goto Forum:
  


Current Time: Fri Sep 20 05:41:56 CDT 2024