2 Replies Latest reply: Mar 11, 2013 3:37 PM by user346369 RSS

    Oracle forms when-validate-item trigger

    user_anumoses
      Forms [32 Bit] Version 10.1.2.0.2 (Production)
      Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
      With the Partitioning, OLAP and Oracle Data Mining options
      JServer Release 9.2.0.8.0 - Production
      Oracle Toolkit Version 10.1.2.0.2 (Production)
      PL/SQL Version 10.1.0.4.2 (Production)
      Oracle Procedure Builder V10.1.2.0.2 - Production
      PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
      Oracle Query Builder 10.1.2.0.2 - Production
      Oracle Virtual Graphics System Version 10.1.2.0.2 (Production)
      Oracle Tools GUI Utilities Version 10.1.2.0.2 (Production)
      Oracle Multimedia Version 10.1.2.0.2 (Production)
      Oracle Tools Integration Version 10.1.2.0.2 (Production)
      Oracle Tools Common Area Version 10.1.2.0.2
      Oracle CORE 10.1.0.4.0 Production


      I have a field called equip_code and have some validations on the when-validate-item trigger that populates some messages ans then opens a comment box. Next to this equip code item I have a button for list of values. If the user clicks on the button (LOV) I have this code.

           if FORM_SUCCESS then
                     do_key('LIST_VALUES');
      end if;

      How do I force the when-validate-item trigger to fire once the user chooses from the list of values.

      On key-next-item I have this code

      validate(item_scope);
      if form_failure then
      raise form_trigger_failure;
      end if;
      do_key('enter');

      I have this so that when-validate-item trigger fires before key-next. But when the user chooses from list of values, I want the when-validate-item trigger to fire. Any help appreciated.
        • 1. Re: Oracle forms when-validate-item trigger
          Andreas Weiden
          Put an additional VALIDATE(ITEM_SCOPE) in the button's code.
          • 2. Re: Oracle forms when-validate-item trigger
            user346369
            On your LOV button, in the when-button-pressed trigger, just do this:

            Go_item('MY_BLOCK.EQUIP_CODE');
            If Form_Success then
            List_Values;
            End if;

            I don't think you need anything on the key-next-item trigger. If the value of equip_code changes, the WVI trigger will run when focus (the cursor) leaves the field.

            If you want to force validation immediately after the user chooses a value from the LOV, then you can change the List_Values; call above to Do_key('LIST_VALUES'); and then create a Key-ListVal trigger on the item. In its code, you would code: If Show_LOV('MY_LOV') then Validate(Item_Scope);

            You should NOT put validation code in the key-next-item trigger, because it does not run if the user uses the mouse to click into a different field, or uses any number of other methods to leave the field.