2 Replies Latest reply: Dec 6, 2012 1:55 AM by 714270 RSS

    Enable Disable APEX_ITEM

    Sudhir_Meru
      Hi,

      I have a requirement to make the ITEM's enable and disable on a selection based condition. Please check the query below.

      >> SELECT
      >> APEX_ITEM.SELECT_LIST(1,NAME,'All TCP;All TCP,All UDP;All UDP,All ICMP;All ICMP,Custom TCP;Custom TCP,Custom UDP;Custom UDP,Custom ICMP;Custom ICMP') "Protocol",
      >> APEX_ITEM.TEXT(2,PORTS,12,12) "Ports"
      >> FROM
      >> PORTAL

      The above query displays select list and text box,My Requirement is to make textbox enable and disable is when "ALL TCP" or "ALL UPD" is selected from the select list,
      Please suggest me how this item enable and disable.

      I am currently using Oracle apex 3.2 and Oracle 10g enterprise edition
      Thanks
      Sudhir

      Edited by: Sudhir_Meru on Dec 3, 2012 10:54 PM
        • 1. Re: Enable Disable APEX_ITEM
          714270
          Hi Sudhir,

          You can do the following:
          1. Modify your query to assign a unique id to each cell.
          2. Secondly, call a javascript function on change of the select list item. So, your report query can be modified as:
          SELECT
          APEX_ITEM.SELECT_LIST(1,NAME,'All TCP;All TCP,All UDP;All UDP,All ICMP;All ICMP,Custom TCP;Custom TCP,Custom UDP;Custom UDP,Custom ICMP;Custom ICMP','onchange = "javascript:updatePort(this);"','y',NULL,'-SELECT-','f01_#ROWNUM#') "Protocol",
          APEX_ITEM.TEXT(2,PORTS,12,12,'','f02_#ROWNUM#') "Ports" 
          FROM
          PORTAL
          3. Then, write the following javascript function in the HTML header section of your page:
          <script language="JavaScript" type="text/javascript">
          function updatePort(pThis)
          {
           
              var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
              if (pThis.value == "ALL TCP")
              {
                   $('#f02_'+vRow).attr('disabled',true);
              }
              else
              {
                  $('#f02_'+vRow).attr('disabled',false);
              }
           
          }
          </script>
          Edited by: Rohit Kapoor on Dec 3, 2012 11:43 PM
          • 2. Re: Enable Disable APEX_ITEM
            714270
            Did you try the above mentioned solution?