0 Replies Latest reply on Jan 5, 2017 8:30 AM by mopacmike

    Item value from dynamically populated combo box resets upon form submit

    mopacmike Level 1

      Using Acrobat Pro XI on a PC.

      Have form with 2 combo boxes.  Box 2 (descriptionSelect) is dependent on Box 1 (locationSelect).  Box 2 list contains both items and values, populated from array.  The values from box 2 are used to determine format of data entered into another field.

      All of this works great, except for one small problem.  When the form is submitted (to a network folder), the descriptionSelect item value does not transfer with the other form data.  Instead of the selected item description, it appears to reset to it's default value of "-".

      What could be causing the selected item from the descriptionSelect combo box to be reset to "-" upon submitting the form?

      Box 1 item list is already populated.  Item values only, no export values.  Custom Keystroke Script: "SetDescriptions();"

      Box 2 - item list dynamically populated from array. Array contains both item value and associated export value.  Custom Keystroke Script: "SetDataFormat()".

      I added a hidden text box as a possible solution - it correctly displays the selected item name, but data from this field also resets upon form submission.

      Code in this text box (Custom Calculation Script):

      var d = getField("descriptionSelect");

      var idx = d.currentValueIndices;

      var dv = d.getItemAt(idx, false);

      event.value=dv;

       

       

      Document JavaScript:

      //Master List
      // Each entry in this object literal is the name of a location (site)
      // The associated value is the DESCRIPTION followed by the list value, a FORMAT designator
      //100=$, 200=number, 300=percent

      var Descriptions = {
      Discharge: [ ["-","none"], ["Coupon Savings", 100], ["Discharge Rx Vol", 200], ["Rx Capture Rate", 300] ],

      FCH: [ ["-","none"], ["A1c Reduction",  300], ["CAHPS", 300], ["Med Histories", 200], ["Med History Changes", 200], ["Patient Touches", 200], ["Patients at A1c Goal", 300] ],

      FMCC: [ ["-","none"], ["A1c Reduction",  300], ["CAHPS", 300], ["Direct Care Pro Billing", 100], ["Direct Care Pro Cases", 200], ["Incident-to Billing", 100],["Med Histories", 200], ["Med History Changes", 200], ["Patient Touches", 200], ["Patients at A1c Goal", 300], ["Prior Auth Cases", 200] ],

      Sr_Health: [["-","none"], ["A1c Reduction",  300], ["AWV Cases", 200], ["CAHPS", 300], ["Direct Care Pro Billing", 100], ["Direct Care Pro Cases", 200], ["Flu Vaccinations", 200], ["Incident-to Billing", 100], ["Med Histories", 200], ["Med History Changes", 200], ["Patient Touches", 200], ["Patients at A1c Goal", 300], ["Pneumovax Vaccinations", 200], ["Prevnar Vaccinations", 200], ["Prior Auth Cases", 200], ["Vaccination Billing", 100], ["Zostavax Vaccinations", 200] ],

      Steeplechase: [ ["-","none"], ["A1c Reduction",  300], ["CAHPS", 300], ["Direct Care Pro Billing", 100], ["Direct Care Pro Cases", 200], ["Incident-to Billing", 100],["Med Histories", 200], ["Med History Changes", 200], ["Patient Touches", 200], ["Patients at A1c Goal", 300], ["Prior Auth Cases", 200] ],
       
      };   

       

      function SetDescriptions()
      {
         // Only run this code on when the selection is committed. 
         if(event.willCommit)
         {

            // Now get the Description list from the Master List
            // Since the selection is being committed, event.value contains the selection text
            var lst = Descriptions[event.value];
           
            if( (lst != null) && (lst.length > 0) ) {
               this.getField("descriptionSelect").clearItems();
               this.getField("descriptionSelect").setItems(lst);
            }
            else
            {
               this.getField("descriptionSelect").clearItems();
            }
         
         }
      }

       

      //this function displays the data entry in the correct format
      //100=$, 200=number, 300=%

      function SetDataFormat()
      {
          //var df = Descriptions[event.value];

          var nSelExp = 0;
          if(!isNaN(event.changeEx)) {
           nSelExp = event.changeEx
             

      switch(nSelExp)
      {
      case "100":
          //dollars
          this.getField("amount1").display = display.visible;
          this.getField("amount2").display = display.hidden;
          this.getField("amount2").value = "";
          this.getField("amount3").display = display.hidden;
          this.getField("amount3").value = "";
          this.getField("txtformat").value = "dollar amount                               $";
          this.getField("Category").value;    
      break;

      case "200":
          //number
          this.getField("amount1").display = display.hidden;
          this.getField("amount1").value = "";
          this.getField("amount2").display = display.visible;
          this.getField("amount3").display = display.hidden;
          this.getField("amount3").value = "";
          this.getField("txtformat").value = "quantity (as a whole number)                  ";
          this.getField("Category").value;
          break;

      case "300":
          //percentage
          this.getField("amount1").display = display.hidden;
          this.getField("amount1").value = "";
          this.getField("amount2").display = display.hidden;
          this.getField("amount2").value = "";
          this.getField("amount3").display = display.visible;
          this.getField("txtformat").value = "percentage (as whole number)                %";
          this.getField("Category").value;
          break;

      //default:
         // this.getField("amount1").display = display.hidden;
          //this.getField("amount2").display = display.hidden;
         // this.getField("amount3").display = display.hidden;
         // break;

      }

          }
      }