2 Replies Latest reply: May 9, 2014 3:42 PM by TexasApexDeveloper RSS

    Cascading POPUP LOV in a tabular form

    HarryF

      I am trying to get a cascading POPUP LOV to work in tabular forms. I can get cascading select lists to work with the code below but it does not work with POPUP LOVs.

       

      One complication with POPUP LOVs in tabular forms is that a hidden field is created with the return value. I can handle that when the POPUP LOV is not cascading but it causes trouble when cascading.

       

      Another complication with POPUP LOVs is that the APEX_ITEM functions to create them do not set the id when you pass it. You can send an id as an attribute but then the hidden field is not in sync with the POPUP field. In fact it looks like all the hidden LOV fields have the same id of fnn_0000.

       

      This code works for select lists.

       

      function f_set_casc_sel_list_item(parentField,ChildField){

        var l_rec_nbr = $x(parentField).value;

        var l_Select = document.getElementById(ChildField.id);

        if(l_Select){

          apex.server.process( 'GET_UPDATED_LOV_STRING',

                               {x01:l_rec_nbr},

                               {dataType: "xml",

                                success: function(pData) {

                                           var l_xmlDoc = pData;

                                           var l_Count = l_xmlDoc.getElementsByTagName("option").length;

                                           l_Select.length = 0;

                                           for(var i=0;i<l_Count;i++){

                                             var l_Opt_Xml = l_xmlDoc.getElementsByTagName("option")[i];

                                             appendToSelect(l_Select, l_Opt_Xml.getAttribute('value'),

                                                                      l_Opt_Xml.firstChild.nodeValue);

                                           }

                                         }

                               }

                             );

        }

      }

       

      function appendToSelect(pSelect, pValue, pContent) {

         var l_Opt = document.createElement("option");

         l_Opt.value = pValue;

         if(document.all){

             pSelect.options.add(l_Opt);

             l_Opt.innerText = pContent;

          }else{

             l_Opt.appendChild(document.createTextNode(pContent));

             pSelect.appendChild(l_Opt);

         }

      }