0 Replies Latest reply on May 8, 2016 3:47 PM by pdfUser1

    Issue with List Sort javascript

    pdfUser1 Level 1

      I have this script and it seems to work fine (to sort items in the drop down box it's associated with). Recently, I've discovered it also will trim down the items (or names) as I type the letters into the drop down field. If I type in, lets say, "A" then all the names that start with A will show. If I type in the second letter, lets say, "Al" for Albert, then all the names that start with "Al" will show and the list will continue to trim down as I type.


      The issue is, if I enter the first letter of the name, like I've said, will show. Then I can select a name out of all the results. But, when I type the second letter in (or third,etc), and try to select it, the first name in the list will show in the drop down window, not the one I selected.


      I would like to be able to trim the list with the letters I type into the drop down, but also be able to select it and that name will show in the drop down window as the name selected. Can someone give it a try to understand it better? So, below are the javascripts I'm using



      function ListEntrySort(cFldName)


      var oFld = this.getField(cFldName);

      var nSelIdx = oFld.currentValueIndices;


      nSelIdx = nSelIdx[0];

      var cSelName;

      var aEntries = [];

      var oExports = {};

      for(var i=0;i<oFld.numItems;i++)


      var cEntry = oFld.getItemAt(i,false);

      var cExport = oFld.getItemAt(i,true);


      oExports[cEntry] = cExport;

      if (i == nSelIdx)

      cSelName = cEntry;



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

      if (aEntries[i] == cSelName)

      nSelIdx = i;

      aEntries[i] = [aEntries[i],oExports[aEntries[i]]];



      oFld.currentValueIndices = nSelIdx;



      Action: MouseDown



      and that's it. Can someone tell me what to add or take away to accomplish the fix for this issue? I have tried to figure this out on my own, but it's too advanced for me to do on my own. Thanks.



      I miss the AcrobatUsers forum.