3 Replies Latest reply on Sep 19, 2010 5:29 PM by woodtd

    Populating a combo box based on another c/b Acrobat 9 Pro

    woodtd

      Greetings,

        I have followed Thom Parkers tutorials and have tried several variations over the course of the last two weeks but all to no avail.

       

        I am constructing a small form for work.  The form has one combo box that, based on the choice, populates a second one.  In this case the form allows the patient schedulers to select a "currentDiagnosis" (e.g." Brain_Seizure", "Brain_Tumor", etc).  Based on the selection a second combo Box is populated with appropriate CPT codes, "currentCPT" (e.g. "151.2","152.2", etc).

       

      Document Level Script

      // Master List of Lists
      // Each entry in this object listeral is the name of a currentDiagnosis
      //Select the currentDiagnosis from the combo box
      // The associated value is the CPT list, where each item is an appropriate CPT code, [<code>

      ]

      var ocurrentDiagnosis = {
      Brain_Seizures: [ ["-"], ["150.1"], ["150.2"], ["150.3"],["150.4"]],
              Brain_Tumor: [ ["-"], ["151.1"], ["151.2"], ["151.3"], ["151.4"]],
      Lung_nonSamllCell: [ ["-"], ["152.1"], ["152.2"], ["152.3"],["152.4"]],
              Lung_SmallCell: [ ["-"], ["153.1"], ["153.2"], ["153.3"], ["153.4"]]
      };


      function SetcurrentCPT()
      {
         if(event.willCommit)
         {
            // Get the CPT list from the Master List
            // Since the selection is being committed,
            // event.value contains the currentDiagnosis
            var lst = ocurrentDiagnosis[event.value];


            // Clear the Parts list if there are no parts for the selected assembly
            if( (lst != null) && (lst.length > 0) )


               this.getField("currentCPT").setItems(lst);


            else


              {


               this.getField("currentCPT").clearItems();


              }


         }


      }

       

      Keystroke event "currentDiagnosis"

      setcurrentCPT();

       

      The form is finished with the exception of getting these two fields to cooperate (LOL) with each other.

       

      Any assistance wiould be greatly appreciated.

       

      Tim

       

      System:

      2.66 Intel Quad core

      5700 1GB video

      8GB Ram

      Windows 7 64bit

      Adobe Acrobat 9 Professional

        • 1. Re: Populating a combo box based on another c/b Acrobat 9 Pro
          George_Johnson MVP & Adobe Community Professional

          According to the code you posted, the line:

           

          setcurrentCPT();

           

          Should be changed to:

           

          SetcurrentCPT();

           

          or alternatively, rename the function to: "setcurrentCPT"

           

           

           

          Also, "Lung_nonSamllCell" is probably misspelled.

          • 2. Re: Populating a combo box based on another c/b Acrobat 9 Pro
            gkaiseril MVP & Adobe Community Professional

            If you put your element object names within quotation marks you will not need the underline in the name.

             

            // Master List of Lists
            // Each entry in this object listeral is the name of a currentDiagnosis
            //Select the currentDiagnosis from the combo box
            // The associated value is the CPT list, where each item is an appropriate CPT code, [<code>

            var ocurrentDiagnosis = {
            "Brain Seizures": ["-", 150.1, 150.2, 150.3, 150.4],
            "Brain Tumor": ["-",151.1, 151.2, 151.3, 151.4],
            "Lung nonSamllCell": ["-", 152.1, 152.2, 152.3, 152.4],
            "Lung SmallCell": ["-", 153.1, 153.2, 153.3, 153.4]
            };

             

            function SetCurrentCPT()
            {
               if(event.willCommit){
                  // Get the CPT list from the Master List
                  // Since the selection is being committed,
                  // event.value contains the currentDiagnosis
                  var lst = ocurrentDiagnosis[event.value];

                  // Clear the Parts list if there are no parts for the selected assembly
                  if( (lst != null) && (lst.length > 0) )
                     this.getField("currentCPT").setItems(lst);
                  else
                     this.getField("currentCPT").clearItems();

                 }
            return;
            }

            • 3. Re: Populating a combo box based on another c/b Acrobat 9 Pro
              woodtd Level 1

              Mr. Johnson,

                Wow, one small typo in the code was all that has held me back for two weeks.  THANK YOU SO MUCH!

               

              and good catch on the nonSmallCell as well.

               

              Thnak you again,

              Tim