6 Replies Latest reply: Aug 2, 2013 7:17 AM by vk RSS

    Disable template based button

    vk

      Hi ,

       

      I m using Oracle 11g and Apex - 4.0.2 version

       

      I m having a request to disable template based button based on condition.

       

      Template based button name 'Activate'

      When button clicked for first time it would perform a process and then it should disable the buttons.

       

      Is it possible?

       

      Regards,

      vk.

        • 1. Re: Disable template based button
          jozef_SVK

          Hi vk,

           

          If do you want to have the button permanent disabled, just create some new column (for example: ACTIVATE_IDC) in a table where you can store the value like 'Y/N': (default 'N') - create it like some hidden item.

          Then create a dynamic action (DA) on button "Activate" - "on Click" where you can use two true processes:

          1) PL/SQL update the column ACTIVATE_IDC to Y

          2) Submit page with some request or some other processing you need

           

          Crete another DA - "Page load" with condition when "ACTIVATE_IDC = 'Y'"

          when true: Disable the button

           

          Don't forgot set the Static ID for the button when needed.

           

          When you run the page again, the button will be disabled now.

           

          Sorry for my English

           

          J

          • 2. Re: Disable template based button
            vk

            Hi J,

             

            In my verison, to  create a dynamic action (DA) on button is not available.

            Do I need to choose DOM object?

            Is so, then I need the button attribute value right which is always returning NULL to me..

             

            How can be defined then?

            • 3. Re: Disable template based button
              jozef_SVK

              Hi,

               

              I used the same version of APEX before. You can choose it to DOM object or by jQuery selector.

              I didn't use the DA on button. Only on jQuery selector (#BTN_ACTIVATE).

               

              I can provide some example on apex.oracle.com if do you need.

               

              here is some example using jQuery selector:

              http://apex.oracle.com/pls/apex/f?p=29601:8:12208770689466:::::

              login: demo/demo

              tab: Button_test

               

              Regards

              J

              • 4. Re: Disable template based button
                vk

                Hi J, Sorry!!! I m not good in JQuery. But seen ur application. That is requirement. Pls explain me how to use JQuery selector. Thanks, vk.

                • 5. Re: Disable template based button
                  jozef_SVK

                  Hi,

                  When you inspect your button element via firebug or chrome or some other HTML inspector, do you see nay ID of the button ? or button name ?

                   

                  If yes, you can use jQuery selector by: #BTN_ACTIVATE   (BTN_ACTIVE is the button ID) or [name='BUTTON_NAME'] here is used the button name attribute instead of ID.

                  You can choose first option..

                   

                  First try a simple test with Dynamic action like this.

                  DA : Event: Click

                  Selection Type : jQuery Selector

                  jQuery Selector: #BTN_ACTIVATE   (or [name='BUTTON_NAME'])

                   

                  As a true action set only the alert with some message. If the message appear, the selector is written OK. If not try to look at the jQuery Selectors

                  Don't forgot to set the when click button option - there is Submit page as default.

                   

                  regards

                  J

                  • 6. Re: Disable template based button
                    vk

                    Thanks J. It works fine..

                    I have tried like this..

                    In button 'Active' - gave Button Attributes - name = 'Active'.

                    In dynamic action, defined the hidden item, if flag sets to 'Y' then 'DOM object' - 'Active' is disabled.

                      Thanks for ur timely help.

                    Regards,

                    vk.