7 Replies Latest reply on Apr 26, 2013 1:06 PM by SAYYED

    Disable form item in oracle apex 3.2

    SAYYED
      Hi,

      I am new to oracle apex, please help me from this problem.

      I'm having form item called "P805_COMP_ID" as text field , i need disable it always, for the same i fallowed some steps with the refrence of the link https://forums.oracle.com/forums/thread.jspa?threadID=2309731

      Step 1 i have written the jquery

      *<script type="text/javascript">*
      *$(document).ready(function(){*
      hideAdvsearch();

      *});*
      function DisableItems()
      *{*
      *$x_disableItem('P805_COMP_ID',true);*
      *}*
      *</script>*


      Step2 : and i'm calling same function in HTML Form Element Attributes

      onload="DisableItems();"

      but it is not working, please help me,


      Thanks and regards,
      Ibrahim Sayyed.
        • 1. Re: Disable form item in oracle apex 3.2
          swesley_perth
          i need disable it always
          Why not modify the item definition to be "Display only" ?
          Or set read only condition to "always" ?

          In future, please define why "it is not working" - supplement at least with some error messages.
          • 2. Re: Disable form item in oracle apex 3.2
            SAYYED
            Hi scott,

            Thank you for your response.

            I'm having more than 10 form items amoung 48 which needs to be disable.

            If i select item type Display only for that 10 items, form layout looking ugly.

            and it is not showing any error message.
            • 3. Re: Disable form item in oracle apex 3.2
              swesley_perth
              Check your browser console.

              Where is hideAdvsearch defined?
              • 4. Re: Disable form item in oracle apex 3.2
                Hari_639
                Hello,

                Please put following code in "Page HTML Header action". That should do the needful. Step-2 is not required.
                <script type="text/javascript">
                $(document).ready(function(){
                hideAdvsearch();
                DisableItems();
                });
                function DisableItems()
                {
                $x_disableItem('P805_COMP_ID',true);
                }
                </script>
                Also please mention your APEX, DB, Web-Server, Browser details when you post some question.

                You can also set-up an example at apex.oracle.com to demo your issue :D

                Regards,
                Hari
                • 5. Re: Disable form item in oracle apex 3.2
                  SAYYED
                  Hi Hari,


                  I am sory to late respond ,

                  The above scenario is working fine , after calling same function in header and footer atribute.

                  but it is not working properly if i put condition.

                  as per below mentioned code if item value 'P802_INT_COMP_ID' is null then it should disable else it should enable.


                  <script language="JavaScript" type="text/javascript">
                  $(document).ready(function(){
                  hideAdvsearch();
                  DisableItems();
                  });
                  Function DisableItems()
                  {
                  if ($v('P802_INT_COMP_ID').val== null)
                  {
                  $x('P802_TEMP_LOG').disabled = true;
                  }
                  }
                  </script>

                  Thanks and regards,
                  Ibrahim Sayyed.
                  • 6. Re: Disable form item in oracle apex 3.2
                    Hari_639
                    Please try..
                    <script type="text/javascript">
                        $(document).ready(function () {
                            hideAdvsearch();
                            DisableItems();
                        });
                    
                        function DisableItems() {
                            /*$v returns the value of item, it's not JS Object. Also there is nothing called null in JS*/
                            if ($v('P802_INT_COMP_ID') == "") $x_disableItem('P802_TEMP_LOG', true);
                        }
                    </script>
                    Regards,
                    Hari

                    Edited by: Hari_639 on Apr 26, 2013 4:27 PM
                    • 7. Re: Disable form item in oracle apex 3.2
                      SAYYED
                      It is working fine...................

                      Thank you so much hari, thanks a lot.

                      Thanks and regards,
                      Ibahim Sayyed.