6 Replies Latest reply: Oct 7, 2013 3:32 AM by Ziut RSS

    how change colour of field?

    Ziut

      Hi!

       

      My worspace is:

       

      http://apex.oracle.com/pls/apex/f?p=4500:1000:6947950655943

      and parameters: jwozniak/jwozniak/jwozniak

       

      only one standard application and page 8 Product Availability.

       

      when I choose Available as No I would like to change colour of List Price field (from green to red) and disable this field.

       

      I've done:

       

      1. In HTML Header is javascript:

       

      <script type="text/javascript">

       

      function html_disableItem(nd,a){

         var lEl = document.getElementById(nd);

         if (lEl && lEl != false){

             if(a){

                 lEl.disabled = true;

                 lEl.style.background = '#882020';

             }else{

                 lEl.disabled = false;

                 lEl.style.background = '#428820';

             }

         }

         return true;

      }

      function disFormItems(){

      var lRadios = document.getElementById('P8_AVAILABLE').getElementsByTagName('INPUT');

      var lReturn;

      for(var i=0;i<lRadios.length;i++){

        if(lRadios[i].type.toUpperCase() == 'RADIO' && lRadios[i].checked){lReturn = lRadios[i].value;}

      }

      var lTest = lReturn == 'N';

      html_disableItem('P8_LIST_PRICE',lTest);

      }

      </script>

       

      2. for item P8_AVAILABLE in section Element in HTML Form Element Attributes is:

       

      onchange="disFormItems()"

       

      3. In HTML Header in Display Attributes in field Cursor Focus is Do not focus cursor.

       

      4. In HTML Header in in Page HTML Body Attribute is:

       

      onload="disFormItems(); first_field();"

       

      This exercise was in previous version apex tutorial and it worked (maybe apex2 or 3 - I don't remember). But in Apex 4.2 - no.

       

      Question is where is error or how to do it in other way?

      Thanks!

        • 1. Re: how change colour of field?
          vincent_deelen

          Hi,

           

          Man what a drag! You had one typo in the definition of your radio button. It had a traling space "STATIC2:Yes;Y,No;N ", instead of "STATIC2:Yes;Y,No;N". Therefore the value of the 'No' button was "N " and never validates to true. I removed the space and your code works fine.

           

          One thing though, your code as it is, is a bit fragmented over page header, item field attributes etc. I've set up a dynamic action that can also handle the change of List Price. The dynamic action can bundle your code on a single place, which is nice from a maintenance point of view.

          The dynamic action has its condition set to 'Never', so it doesn't do anything at the moment. If you want to see it work, you can put the display condition to 'None'.

           

          Regards,

          Vincent

          • 2. Re: how change colour of field?
            Ziut

            Hi vdeelen

            You are right: Man what a drag!

            Thank you for your help.

             

            Could ypu tell me what should I do to see on the botton of screen tool bar: Home Application 12555 Edit Page 8 etc.

            On apex.oracle.com I see it but in my instalation - no. It depends on internet browser?

            • 3. Re: how change colour of field?
              vincent_deelen

              Hi,

               

              To show the Developer Toolbar, you must ensure that:

              1) the 'Status' attribute under the 'Edit Application Definition' tab is set to 'Available with Edit Links'.

                  In Apex 4.2.x go to 'Shared Components'>'Globalizatoin Attributes'>'Definition' tab, then it's the first attribute undetr the 'Availability' section.

              2) you're logged in as developer in to the Application Builder in the same browser session.

               

              Regards,

              Vincent

              • 4. Re: how change colour of field?
                Ziut

                Hi Vincent

                 

                Status is correct but it dosn't work.

                Look in my apex:

                http://oracle.vizja.net:2458/apex/apex

                and parameters: tb2/tb2/tb2

                 

                Regards

                Joseph

                • 5. Re: how change colour of field?
                  vincent_deelen

                  Hi Joseph,

                   

                  So I see. Is your installation upgraded from an older version of ApEx? There is a known issue for that:

                  Oracle Application Express 4.2.2 - Known Issues

                   

                  "

                  16769040 - DEVELOPER TOOLBAR IS MISSING AFTER UPGRADING TO 4.2.2

                  After upgrading to 4.2.2, the developer toolbar can be missing when running applications from within the Application Express builder environment.

                  Solution: There is a patchset exception for this available on My Oracle Support - search by bug number.

                  Alternative Workaround: Run the following code logged in as SYS as SYSDBA -

                    begin

                      apex_040200.wwv_flow_security.set_internal_cookie_name;

                      commit;

                    end;

                    /

                  "

                   

                  Regards,

                  Vincent

                  • 6. Re: how change colour of field?
                    Ziut

                    Bingo!!

                    Thanks Vincent