Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Clearing Form when changing from Insert Mode to Enter/Execute Query

RoxyrollersSep 28 2012 — edited Sep 28 2012
Morning folks,
I need some help or pointers with a form I am working on. At startup, the form is in Insert mode. I am using Oracle Forms 9i.

Goal: Clear the form with NO_VALIDATE when User enters an ID in Insert mode and clicks on the Execute Query button(DEFAULT&SMARTBAR Inbuilt Menu)

The user can do two things when they first open the screen.

Option 1: Enter the STUDENT_ID and press Tab
Option 2: Enter the STUDENT_ID and press the Execute Query button (Part of the DEFAULT&SMARTBAR Inbuilt Menu)

There is a When-Validate-Item trigger on STUDENT_ID to check if the Student ID already exists in the database. If it does, it gives an Error message saying "Student ID found. Please Query the record or enter a new Student ID". This is fine with Option 1.

The problem arises with Option 2. When I Enter a Student ID in Insert Mode and (thinking I am in Enter Query mode) and press the Execute Query button, I get two messages:
Message 1: "Student ID found. Please Query the record or enter a new Student ID"
Message 2: Oracle message "Do you want to save the changes? Yes/No/Cancel.

Is there a way to stop this *Message 2?*

Here is what I have done to try and mitigate this situation. I have created a non database field and have called it clear_form.

In When-Validate-Item I set the field clear_form = 1 when I encounter *Message 1*
{code}
if t_record_exists > 0 then
set_alert_property('ALERT_ERROR',ALERT_MESSAGE_TEXT,'Student ID found. Please Query the record or enter a new Student ID');
alert_button := show_alert('ALERT_ERROR');
:clear_form := 1;
end if;
{code}

By creating *Key-EXEQRY* Trigger at Form Level, I was hoping that it would just clear the form. I put some messages and its seems to me that *KEY-EXEQRY* is firing first and then the *WHEN-VALIDATE-ITEM*. Is there a way to have the *WHEN-VALIDATE-ITEM* trigger fire first?

{code}
if :clear_form is null then
execute_query;
else
clear_form(no_validate);
end if;
{code}

Thanks!

Edited by: Roxyrollers on Sep 28, 2012 8:50 AM

Edited by: Roxyrollers on Sep 28, 2012 9:45 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 26 2012
Added on Sep 28 2012
1 comment
1,200 views