4 Replies Latest reply: Sep 6, 2013 9:03 AM by bsalvador RSS

    Disable many items based on values of another page/table

    bsalvador

      Hi people,

       

      I have a form with 15 fields like:

       

      Form1

       

      id_plan = 1

      level 1 = 2

      level 2 = 2

      level 3 = null

      level 4 = null

      level 5 = null

      level 6 = null

      and so on...

       

      After, in another form I have:

       

      Form2

      id

      id_plan (from "form1")

      account: 10.01 (based on the number of decimal places defined on the level from "form1" )

       

      So, I need to disable Form1 page items if I had some Form2 values. But only levels where Account is registered. At the example above, only level 3, level 4, level 5, level 6 and so on would be enabled.

       

      Any suggestion?

       

      I could put a read only condition for any page item, is it right? or there is another suggestion?

       

      thanks

       

      bsalvador

        • 1. Re: Disable many items based on values of another page/table
          Nick B

          Hello,

           

          Please mention what version of APEX you are on. One of the new features in APEX 4.2 is the ability to put a read-only condition on page and region level. Lower versions will have to revert to the condition on page item level.

           

          Cheers,

          Nick

          • 2. Re: Disable many items based on values of another page/table
            vincent_deelen

            Hi bsalvador,

             

            I've had a simular situation once where I needed to make items disabled or required depending on a workflow step and on depending on other page items. Basically the disabling of items is done by javscript, keep in mind that readonly is not the same as disabled. When you use readonly, the item can still be manipulated with javascript. When you disable an item, the item is not even submitted to the database, so you have to make sure that your submit process can hadle that.

             

            There are two different situations:

            First you have the page load / page submit, there you can use PL/SQL to check which items should be submitted, hand them a javascript class or make them readonly/disabled straight away.

            Second you have a situation where you want to disable certain items depending on the value of other items. This is done 'on the fly' and should be handled with a javascript function.

            Keep in mind however that javascript runs client side and isn't a secure way to handle data integrity, so you would need a database process to validate which items need to be submitted as well.

             

            Regards,

            Vincent Deelen

            • 3. Re: Disable many items based on values of another page/table
              jozef_SVK

              Hi,

               

              You can try to use dynamic actions (disable/enable) if you are on apex 4.0 or higher.

              Example:

              Dynamic action (on Page Load) - Form1

              Condition: if some item value in form1 has some value (P1_DUMMY_ID_PLAN = '10.01') or (P1_level1 = 1 and P1_level2 = 2) or something similar

              True action: disable -> items: list of your items to be disabled (P1_level1,P1_level2)

               

              It should be better if you reproduce your needs to apex.oracle.com

               

              Regards

              J

              • 4. Re: Disable many items based on values of another page/table
                bsalvador

                Hi people,

                 

                To solve my question, I used read only option. I selected PL/SQL Function body returning a boolean and put

                 

                begin

                 

                if(CST_RETURN_LEVEL(:P7_ID_PAR_PLANO_GER) >= 2 ) then

                   return true;

                end if;

                 

                end;

                 

                where CST_RETURN_LEVEL is a function that returns the last level filled. If page item is level 2, then I test, if CST_RETURN_LEVEL(:P7_ID_PAR_PLANO_GER) >= 2 then I returned true to read only and so on for other page items.

                 

                thanks

                 

                bsalvador