Home » Developer & Programmer » Forms » Format mask error handling - help! (10g)
Format mask error handling - help! [message #354334] Fri, 17 October 2008 15:19 Go to next message
cgage
Messages: 3
Registered: October 2008
Junior Member
I'm having a problem with handling invalid user
entries in a field with a format mask applied
at the Property Palette and error message notification
via a ON-ERROR trigger

The account number is a 22-digit number,
and the 'ACCOUNT_NUMBER' field has a property palette format
mask of 99'-'9999'-'9'-'9999'-'9999'-'9999'-'999


Current behavior: When users type an invalid account
number in the field e.g. '123', or 'abc', an FRM-40209
format mask error is thrown, and it is handled via
an ON-ERROR trigger which detects the FRM40209 error
and puts up an 'Invalid account number' message.

The problem is that it puts this message up TWICE...

Q: Is there a way to suppress the second message from
popping up?

Thank you for your responses....
Re: Format mask error handling - help! [message #354384 is a reply to message #354334] Sat, 18 October 2008 05:43 Go to previous messageGo to next message
subba99
Messages: 31
Registered: September 2008
Member
place Raise form_trigger_failure after the message

eg..........

Message('Invalid account number message');
Raise form_trigger_failure;




Thanks&Regards
---------------
subbu

[Updated on: Sat, 18 October 2008 05:44]

Report message to a moderator

Re: Format mask error handling - help! [message #354481 is a reply to message #354384] Sun, 19 October 2008 13:02 Go to previous messageGo to next message
cgage
Messages: 3
Registered: October 2008
Junior Member
I'm Sorry that I didn't email my
code home so I could have put it up.
Also, it appears that I left out some detail
(as always..). There is a KEY-NEXT-ITEM trigger
on the account_number field which moves the cursor
to the next account_number field if nothing is entered
(NULL), or to the Amount field if a valid account number
is entered.

the format that is always used when I
generate Alert messages is:

nError := ALERT_PKG.STOP_OK('Invalid account number.')
RAISE FORM_TRIGGER_FAILURE;

So your response doesn't answer my question...

I think the code for the ON-ERROR is something like this:
Don't pick at my syntax right now - I'm still a raw
beginner and I'm doing this from weak memory...

DECLARE
cType VARCHAR2(3) := ERROR_TYPE;--(however this gets assigned)
cError NUMBER := ERROR_CODE;--(same here)
cDesc VARCHAR2(30) := ERROR_TEXT;--(etc)
cCode VARCHAR2(10);

BEGIN
cCode := (cType || To_Char(cError) );

If cCode = 'FRM40209' THEN
nError := ALERT_PKG.STOP_OK('Invalid account number.')
RAISE FORM_TRIGGER_FAILURE;
END IF;

END;

I still believe that it may have something to do with
the immediate effect of the KEY-NEXT-ITEM trigger or
perhaps the format mask property of the ACCOUNT_NUMBER
field.

[Updated on: Sun, 19 October 2008 13:08]

Report message to a moderator

Re: Format mask error handling - help! [message #354491 is a reply to message #354481] Sun, 19 October 2008 21:57 Go to previous messageGo to next message
subba99
Messages: 31
Registered: September 2008
Member
HI CGAGE ,I didn't Know the fuction
ALERT_PKG.STOP_OK('Invalid account number.')


In this example ,i set sal field, format mask=$99999, and written ON-ERROR Trigger on sal field when the user try to enter wrong format ,it will dispaly alert message,when u press ok it place the cursor in the same field

please try this code,

declare
cType VARCHAR2(3) := ERROR_TYPE;--(however this gets assigned)
cError NUMBER := ERROR_CODE;--(same here)
ccode VARCHAR2(30) := ERROR_TEXT;--(etc)
ctext VARCHAR2(10);
BEGIN
cCode := (cType || To_Char(cError) );
ctext:=GET_ITEM_PROPERTY('emp.sal',FORMAT_MASK);
If cCode = 'FRM40209' THEN
message('enter feild of the form '||ctext);
message(' ');
RAISE FORM_TRIGGER_FAILURE;
END IF;
END;

NOTE:If we use empty message() function after Message() function with message then it displays the message in the form of ALERT dialog box

sorry,I don't know with KEY-NEXT-ITEM trigger,

[Updated on: Sun, 19 October 2008 21:58]

Report message to a moderator

Re: Format mask error handling - help! [message #354681 is a reply to message #354491] Mon, 20 October 2008 16:41 Go to previous messageGo to next message
cgage
Messages: 3
Registered: October 2008
Junior Member
Dear Subba99,

I believe I've solved my own problem...

The error messages were firing twice because
of the KEY-NEXT-ITEM triggers moving the cursor
to the next field automatically after a format
mask error (FRM-40209) is thrown.

I worked around this by putting in code to set
a global flag in the ON-ERROR triggers that capture the
FRM-40209 error (there are several). I then use this flag to determine if an error was thrown while the KEY-NEXT-ITEM trigger
has fired. KEY-NEXT-ITEM is a built-in trigger that fires
when TAB or ENTER is pressed. If the error flag is 'TRUE' then
the cursors are not moved and only one error message is shown.

VOILA. It may not be elegant and perphaps I shouldn't be using
any global variable to pass data between triggers, but it works for now.

Re: Format mask error handling - help! [message #354703 is a reply to message #354681] Mon, 20 October 2008 22:38 Go to previous message
subba99
Messages: 31
Registered: September 2008
Member
hi Cgage can u please send me the .FMB Example file with the solution
Thanks in Advance

subbu
Previous Topic: Set Attribute
Next Topic: window state problem
Goto Forum:
  


Current Time: Wed Dec 07 05:13:15 CST 2016

Total time taken to generate the page: 0.13139 seconds