How to exit form?

How  to exit a form  at runtime, when the input focus is in a required text_item? I am getting an error message
 FRM-40202  "Field must be entered" ,when I tried to use exit_ form built in.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

poncejuaConnect With a Mentor Commented:

FRM-40202 can occur if you are using button items in a block that also contains required fields or fields with validation.
To avoid FRM-40202 when clicking on a button, set the 'Mouse Navigate' item property to FALSE for the button.  The default is TRUE.
For example:
You have a block on dept that contains the required field dept.deptno, and a button with a When-Button-Pressed trigger.  
When you press the button, You receive FRM-40202 "Item must be entered" when the button is pressed.  
Set the 'Mouse Navigate' property to FALSE, and the required field validation will not be fired when the button is pressed.
Solution Explanation:
When 'Mouse Navigate' is FALSE, Oracle Forms does not perform navigation to the button when it is pressed.  When 'Mouse Navigate' is TRUE, Oracle Forms navigates to the item and fires navigation and validation triggers which cause
the FRM-40202 to occur.  You do not have to navigate to the button for the When-Button-Pressed trigger to fire.


You may receive FRM-40202 as intended using radio buttons and radio groups with required fields, but the radio button you are clicking on does not get selected in a consistent manner.  
This behavior is Oracle Forms bug 336430.  Bug 336430 has been reported on Oracle Forms, and also reproduces in Developer/2000 Release 1.3 32-bit Oracle Forms  This bug is still an open issue with Development.
For example:
o You have a radio group as the first item in the block, with 2 radio buttons.  The first radio button is the default.
o The second item in the block is a required text item.  For example, emp.ename
o Run the form
o Click in radio button 1 ( the default ), then click in ename and leave it blank
o If you click on the default radio button after leaving the ename required field blank, you will receive FRM-40202 as expected, but the default button will be selected.
 If you click on radio button 2 ( not the default ) after leaving the ename required field blank, you will receive FRM-40202 as expected, but radio button 2 will NOT be selected.
Workaround for Bug 336430:
Set the 'Mouse Navigate' item property FALSE for the radio group.  This will allow either button to be selected without moving focus off of the required text item.  Thus, FRM-40202 will not occur.
If you must leave the 'Mouse Navigate' property TRUE for the radio group, then you could make the required field text item not required, but then you have to validate this yourself.
Solution Explanation:
The behavior of the radio button that is selected after receiving FRM-40202 is not the same depending on whether the radio button selected is the default. This inconsistency is reported in Oracle Forms bug 336430.

You may receive FRM-40202 when trying to go into ENTER-QUERY mode.  This is Oracle Forms bug 324949.
Bug 324949 occurs going into ENTER-QUERY mode when the first item in the  block has a format mask and item is required.   This bug has been fixed in Oracle Forms 4.5.7 and above.
For example:
 1.  Create a form with a block based on the scott/tiger emp table
 2.  The first field in the form should be empno
 3.  Add a format mask to the empno field of 9999
 4.  Run the form
 5.  Enter a number in the empno field  
 6.  Use the backspace key to delete the value in the empno field
 7.  Select Query->Enter to from the default Runform menu to enter a query.  
     You will get FRM-40202 as expected.
 8.  Select Record->Clear from the default Runform menu
 9.  Select Query->Enter to from the default Runform menu to enter another query.  Again, you get FRM-40202.  
10.  This prevents you from entering a query, executing a query, clearing the block, removing the record, etc.
Workaround for Bug 324949:
This bug does not reproduce when the first item in the block is required, but does not have a format mask.  Thus, remove the format mask from the first item.
Solution Explanation:
Bug 324949 is causing FRM-40202 to occur incorrectly if the first item contains a format mask.  Upgrade to Oracle Forms 4.5.7 or above to resolve this bug.

Oracle Forms bug 273420 causes FRM-40202 to occur when trying to call another form using OPEN_FORM when a required field is empty on the current form.  This bug affects Oracle Forms 4.5.5.X and 4.5.6.X, and is reported fixed in 4.5.7.X.  
Workaround for Bug 273420:
To avoid this error, set the validation_unit form property to form_scope before using OPEN_FORM.
For example:
/** In whatever trigger you are using to open the form **/
/** Create a When-Window-Activated trigger in the calling form.  This   **/
/** will set the validation unit back to item_scope when returning from **/
/** the other form.                                                     **/
     END IF;
Solution Explanation:
OPEN_FORM should not attempt to validate the current form before opening the second form.  Setting the validation unit will work around this error by specifying the scope of validation to be at the form level, instead of the item level ( the default ).

You may receive FRM-40202 when you attempt to cancel changes in a record that contains a required field.
To cancel changes made in a record without having to enter values in the required fields:
1.  Use the Record->Clear Menu Option:
    The form operator can use the Record->Clear menu option from the default Oracle Forms Runform menu.
2.  Use the CLEAR_RECORD built-in:
    You can programmatically call the CLEAR_RECORD Oracle Forms built-in.
    For example:
    You could have a button labelled 'Cancel', and the following
    When-Button-Pressed trigger:
    Make sure the 'Mouse Navigate' item property for the button is FALSE.  Otherwise required field validation will not allow navigation out of a required field when trying to press the 'Cancel' button, if data has not been entered.
Solution Explanation:

CLEAR_RECORD causes Oracle Forms to remove, or flush, the current record from the block without performing validation.


FRM-40202 may occur navigating to another block after using a
When-New-Record-Instance trigger to programmatically assign default values to the block you are navigating from.
To avoid FRM-40202 in this situation, use the When-Create-Record trigger to assign the default values instead of the When-New-Record trigger.
Solution Explanation:
After the When-New-Record-Instance trigger fires, the SYSTEM.RECORD_STATUS is changed to INSERT.  After the When-Create-Record trigger fires, the SYSTEM.RECORD_STATUS remains NEW, and the user will be able to navigate to another block.
The When-Create-Record trigger only populates a record with the equivalent of default values, and does not attempt to alter the record status, and until the operator changes the record, the status will remain NEW.
Bug 308106 is causing Oracle Forms 4.5.6 to not correctly report the status of the record as NEW.  The SYSTEM.RECORD_STATUS should reflect NEW after the
When-Create-Record trigger fires, and is reflecting INSERT status.  This bug is reported as fixed in Oracle Forms 4.5.7.X.
Additional Information:
Oracle Forms 4.X Reference Manual Volume 1,
Chapter 2, Triggers
           When-Create-Record Trigger
           When-New-Record-Instance Trigger
Chapter 4, System Variables

I hope this helps you.

Best regards,

Juan Manuel Ponce Martinez
DBA - Buenos Aires - Argentina
Hai Venkat !

I have 2 solutions for your answer. If you are trying to EXIT the form without VALIDATING
the records (i.e without committing). Am I Right ! Fine.

Then use this COMMAND in your code
Solution 1



Solution 2 :


I hope this is acceptable to you, If you have any problems, you are always welcome
to me.
             Thanks & Regards - sganta

You go to Default Menu


Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

In the key-exit trigger at form level...
if exit_form(no_validate) does not work you could always re-set :system.message_level to 20.  This message is at level 15 and would be suppressed.

If your exit procredure is on a button you should also set mouse navigate to false on the button properties so that focus does not try to move to the button (and out of your mandatory field) when it is pressed.

If you reject this answer please add a comment to explain why - it usually helps to clarify the problem.

Venkat052498Author Commented:
Thank you for taking pain.I tried your solutions.The message was suppressed,but i am
not out of form.To make you clear,i am elaborating the problem.I have called a form through NEW_FORM built in with NO_QUERY_ONLY argument.The first interface item is text item with no base table.Due to some reason immediately after form start up i tried to exit the form through EXIT_FORM(no_validate) built in when the infut focus is in required field.  But i failed to exit. Try to solve my problem.

Without seeing the code it is hard to tell exactly what is happening.
A possible solution is that when you call EXIT_FORM you are in Enter Query mode (try checking with "IF :System.Form_Status = 'QUERY' ") in this case EXIT_FORM will cancel the query not exit the form (but in this case I would not expect the FRM-40202 message).  
Another possibility is that the form is in a CALL_INPUT function, EXIT_FORM would terminate the CALL_INPUT function.

In either case you would need to call EXIT_FORM twice to exit the form - try it to see what happens.

I assume the last answer did not help, as far as I am aware exit_form should work unless one the the two conditions I mentioned are present.  With the limited description supplied I have no more suggestions - I would need to see the actual code to spot what is/is not happening.

What kind of trigger are you using?
Perhaps you could post the exact text of the trigger.

Venkat052498Author Commented:
Dear Poncejua,
                      Thank you, for your exhaustive analysis.By setting mouse navigate property to false,the problem was solved.

With Regards
Is that not what I suggested in my first answer?

Venkat052498Author Commented:
 Dear vlad impala,
                           Yes,you are right.But some reason,when i tried it did not worked for me.I remember your answer,but i already rejected your answer.Sorry.
 Thank you .

 With Regards
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.