This discussion is archived
2 Replies Latest reply: Nov 28, 2012 7:16 AM by CraigB RSS

Disable Button from the same Button Code

961483 Newbie
Currently Being Moderated
Dear Members,

I have a Form which has a Button. Lets Say the Button name "EXECUTE_CO_CUST".

When I press the Button then it does few validations and if all of them are successful then the action completes successfully. I need a way where I can Disable the Button when i press it.(This should only happen when its fails the validations).

In simple terms if I press "EXECUTE_CO_CUST" Button then the Button should be disabled. How can I do that.

I tried using the below code in "WHEN-BUTTON-PRESSED" trigger:
but its giving me the following error:
FRM-41032: Cannot set ENABLED attribute of current item BLOCK.EXECUTE_CO_CUST
  • 1. Re: Disable Button from the same Button Code
    MLBrown Journeyer
    Currently Being Moderated
    Try navigating to a different item before you try to disable that one.
  • 2. Re: Disable Button from the same Button Code
    CraigB Guru
    Currently Being Moderated
    Another option would be to create a Zero (0) second non-repeating Timer in your When-Button-Pressed trigger. This would ensure your button is only disabled when your specific circumstance existed. Here is a small example of how to use a Timer.
    /* When-Button-Pressed trigger */
      t_timer   TIMER;
      IF ( "Your test condictions here " = TRUE ) THEN 
        -- I need to disable the button based on a TRUE condition.
        -- -------------------------------------------------------
        t_time := Create_Timer('DISABLE_BUTTON',1,NO_REPEAT);
      END IF;
    /* Example Module/Form level When-Timer-Expired trigger */
      v_timer   VARCHAR2(30);
      v_timer := Get_Application_Property(TIMER_NAME);
      IF ( v_timer = 'DISABLE_BUTTON' ) THEN 
        /* Notice: the timer name MUST match the declaration (including Case). */
        -- Disable the Calling Button.
        -- ---------------------------
      END IF;
    By the way, It is always a good idea to list your Forms version (eg; versus 10g) when asking questions.

    Hope this helps.



  • Correct Answers - 10 points
  • Helpful Answers - 5 points