1 Reply Latest reply: May 10, 2013 11:01 AM by jrimblas RSS

    Hide/Show Dynamic Action Stopped Working

    MaryM
      Good Morning,

      Once I upgraded my application to Apex 4.2.2, my dynamic action stopped working. It worked fine in 4.1.

      I also used javascript to hide/show my fields.
      code below
      <script language="JavaScript" type="text/javascript">
      function onPgLoad()
       {
       //hides reporting select, unless certain utcs are selected they are selected
        var ForceGenUTCSrch = $v('P310_FORCE_GEN_UTC_SRCH');
        var RptMenu         = $v('P310_REPORT_MENU');
      
      if  (RptMenu == '1'&&(ForceGenUTCSrch == '0GTAA' || ForceGenUTCSrch == '8MMUB' || ForceGenUTCSrch == 'CCMAR' || ForceGenUTCSrch == '0GQGC' || ForceGenUTCSrch == '0GQGB' || ForceGenUTCSrch =='3NNNA' || ForceGenUTCSrch == '3PQAA' || ForceGenUTCSrch == 'XMCAS' || ForceGenUTCSrch == '8NJAA' || ForceGenUTCSrch == 'XMMCB' || ForceGenUTCSrch == '9VCBH' || ForceGenUTCSrch == '3PNAA' || ForceGenUTCSrch == '3PLFA' || ForceGenUTCSrch == '3PMAA' || ForceGenUTCSrch == '3NSAA' || ForceGenUTCSrch == '8NHAA' || ForceGenUTCSrch == 'CBSAD' || ForceGenUTCSrch == 'CCVAA' || ForceGenUTCSrch == '9VDLB' || ForceGenUTCSrch == '3NHAA' || ForceGenUTCSrch=='1HDAA' || ForceGenUTCSrch=='0EZ99' || ForceGenUTCSrch=='0JZ99' || ForceGenUTCSrch=='1AZ99'|| ForceGenUTCSrch=='9YZ99' || ForceGenUTCSrch=='CUZ99'))
          {
          var get = new htmldb_Get(null,null,'APPLICATION_PROCESS=PROC_UTC_RPRTG_ORG',0);
         gReturn=get.get();
      
          $x_ShowItemRow('P310_FORCE_GEN_RPRTG_ORGN');
      
          }   
         else
          {
           $x_HideItemRow('P310_FORCE_GEN_RPRTG_ORGN');
          }
      }
      
      </script>
      
      <script language="JavaScript" type="text/javascript">
      function FunSelUTC()
       {
       //hides reporting select, unless certain utcs are selected they are selected
        var ForceGenUTCSrch = $v('P310_FORCE_GEN_UTC_SRCH');
        var RptMenu         = $v('P310_REPORT_MENU');
      
      alert(RptMenu);
      
      if  (RptMenu == '1'&&(ForceGenUTCSrch == '0GTAA' || ForceGenUTCSrch == '8MMUB'|| ForceGenUTCSrch == 'CCMAR' || ForceGenUTCSrch == '0GQGC' || ForceGenUTCSrch == '0GQGB' || ForceGenUTCSrch =='3NNNA' || ForceGenUTCSrch == '3PQAA' || ForceGenUTCSrch == 'XMCAS' || ForceGenUTCSrch == '8NJAA' || ForceGenUTCSrch == 'XMMCB' || ForceGenUTCSrch == '9VCBH' || ForceGenUTCSrch == '3PNAA' || ForceGenUTCSrch == '3PLFA' || ForceGenUTCSrch == '3PMAA' || ForceGenUTCSrch == '3NSAA' || ForceGenUTCSrch == '8NHAA' || ForceGenUTCSrch == 'CBSAD' || ForceGenUTCSrch == 'CCVAA' || ForceGenUTCSrch == '9VDLB' || ForceGenUTCSrch == '3NHAA' || ForceGenUTCSrch=='1HDAA' || ForceGenUTCSrch=='0EZ99' || ForceGenUTCSrch=='0JZ99' || ForceGenUTCSrch=='1AZ99' || ForceGenUTCSrch=='9YZ99' || ForceGenUTCSrch=='CUZ99'))
           
          {
           //alert(ForceGenUTCSrch);
          var get = new htmldb_Get(null,null,'APPLICATION_PROCESS=PROC_UTC_RPRTG_ORG',0);
         gReturn=get.get();
           $x_ShowItemRow('P310_FORCE_GEN_RPRTG_ORGN');
         //  $('#FORCE_GEN_REPORT1#').show();
          }   
         else
          {
           //alert(ForceGenUTCSrch);
           $x_HideItemRow('P310_FORCE_GEN_RPRTG_ORGN');
          // $('#FORCE_GEN_REPORT1#').hide();
          }
      }
      
      </script>
      
      
      javascript: onload="onPgLoad();"
      I kept the code just in case I needed it @ a later time.

      My Dynamic Action

      Event: on change
      item --> :p310_force_gen_utc_srch (this is a select list that submits)
      conditon --> in list
      value --> '0GTAA', '8MMUB', 'CCMAR', '0GQGC', '0GQGB', '3NNNA', '3PQAA', 'XMCAS', '8NJAA', 'XMMCB', '9VCBH', '3PNAA'

      True Action --> show :p310_force_gen_rprtg_orgn
      False Action --> hide :p310_force_gen_rprtg_orgn

      They both fire on page load.

      The :p319_utc_srch has submits the page because the :p310_force_gen_rprtg_orgn lov runs a query to pull back that units reporting orgs only.

      Please help me figure this out.

      Thanks,
      Mary

      Edited by: MaryM on May 10, 2013 10:52 AM
        • 1. Re: Hide/Show Dynamic Action Stopped Working
          jrimblas
          Hi Mary,
          So you changed from the code presented to a DA ? I'm not clear as to exactly happens or doesn't happen.


          Do you know if your AJAX calls are failing?
          If you use a Console like the one on Firebug or Chrome you can inspect what's being send and what's being returned.

          I mention this because your htmldb_Get calls looks suspicious.
          var get = new htmldb_Get(null,null,'APPLICATION_PROCESS=PROC_UTC_RPRTG_ORG',0);
          I would change it to
          var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=PROC_UTC_RPRTG_ORG',$v('pFlowStepId'));
          That would pass the app_id and the page_id that is calling. Although this is probably not your current issue.

          See if you can find some javascript error. It's possible that this is a timing problem as to when the code is defined and when it's loaded.

          Thanks
          -Jorge