ORacle Forms 10g: How to enable/disable blocks in Master/Detail?

When the block "Instrumento de Avaliacao" was in insert mode and now is saved or the current record is in update mode, i.e. the user is navigating through existing records, the blocks below shall be enabled.

If the block "Instrumento_Avaliacao" is in Insert mode, the blocks below "GRUPOS" and "CRITERIOS" shall be disabled.

Pay attention: The user can navigate through the records without save it. He/she can save the record later and the logic may fail.

Please, see the image of the blocks below:
 Problem 01
Who is Participating?
jocafiAuthor Commented:
Thanks Markgeer,

  before your post, I had unsuccessfully set the property Prevent Masterless Operations = Yes in the relation. It did not force the user to save the record first.

  Well, the workaround was:

1) to set the PK (FIAV_SEQ) in the first block in the PRE-INSERT trigger using the sequence. This field had modified properties: "Insert allowed = no" and "Update allowed = No". For a new record, this field was always empty (NULL).

2) In the 2nd block (detail) I added the trigger WHEN-NEW-BLOCK-INSTANCE like this:

        -- msg: First save the Avaliation Instrument
      MESSAGE('Primeiro, salve o Intrumento de avaliação.');
end if;

That seems to work well. Problem Solved !!!
Mark GeerlingsDatabase AdministratorCommented:
What you are asking for is not easy to do in Oracle Forms.  Basically, Oracle Forms has two modes of operation: "enter query mode" and "edit mode".  When any block is in "enter query" mode, the user cannot navigate out of the current block, but the other blocks are not actually disabled.  Oracle Forms simply will not allow navigation to other blocks until the query is either executed or cancelled.

It sounds like you want modify how Forms works when it is in the normal "edit mode", where it supports inserts, updates and deletes *AND* it normally allows navigation then to other blocks.

When the user is on existing records, either queried records, or just entered (and saved) records you want to allow navigation, but if the block is empty, or if the user navigates past the last record to a new, empty record, you want navigation to be disabled, correct?  If you set the block relationships correctly (Prevent Masterless Operations = Yes) Forms may give you this functionality, at least by not allowing actions in the detail blocks until a master record is entered.  Forms will not actually disable the detail blocks or prevent navigating to them, but it will prevent data entry and/or queries in them in this situation.  
jocafiAuthor Commented:
question solved and closed.
jocafiAuthor Commented:
Workaround created by me to solve the problem. No time to wait for perfect answers. It seems to be the problem is solved by now.
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.