3 Replies Latest reply on Jan 3, 2016 10:44 PM by sp3shalpdfs

    Combobox1 + Combobox2 = Textfield1 - fillable pdf

    sp3shalpdfs Level 1

      Hi there,

       

      I am a little stuck and am new to java and acrobat.

      Recently i have become a wizard with making fillable pdfs due to these forums but now i am stuck.

       

      What im trying to do is have two comboboxs determine the value of a textfield.

       

      e.g.

      Combobox1 Select option = Blue

      Combobox2 select option = Yellow

      Textfield1 displays = Green

       

      Combobox1 Select option = Red

      Combobox2 select option = Yellow

      Textfield1 displays = Orange

       

      I will be using the graph below and would like it to act like this:

       

      Combobox1 Select option = Almost Certain

      Combobox2 select option = Minor

      Textfield1 displays = High (48)

       

      Combobox1 Select option = Rare

      Combobox2 select option = Moderate

      Textfield1 displays = Low (32)

       

      Capture.JPG

      Can i please have some help making this happen, i have searched everywhere but cant find a similar answer in terms i can understand.

        • 1. Re: Combobox1 + Combobox2 = Textfield1 - fillable pdf
          sp3shalpdfs Level 1

          So i have fiddled and got to this:

           

          event.value = "";

          var lh = this.getField("ComboBoxlh1").value;

          var cons = this.getField("ComboBoxc1").value;

           

          if (lh=="Almost Certain") {

              if (cons=="Insignificant")

                  event.value = 40;

              else if (cons=="Minor")

                  event.value = 48;

              else if (cons=="Moderate")

                  event.value = 72;

              else if (cons=="Major")

                  event.value = 84;

              else if (cons=="Catastrophic")

                  event.value =  100;

          } else if (lh=="Likely") {

              if (cons=="Insignificant")

                  event.value = 24;

              else if (cons=="Minor")

                  event.value = 44;

              else if (cons=="Moderate")

                  event.value = 56;

              else if (cons=="Major")

                  event.value = 80;

              else if (cons=="Catastrophic")

                  event.value =  96;

          }

           

          I place this in the custom calculation of a textfield and it displays the number - how can i get it to display Medium (40) instead of 40?

          • 2. Re: Combobox1 + Combobox2 = Textfield1 - fillable pdf
            sp3shalpdfs Level 1

            If i use the calculation in a combobox and have the export value link to the event.value i get it working.

            So i seem to have solved my issue except instead of textbox ill use combo.

             

            Is anyone able to help be colour code the background of the combobox based on the event.value the same as my picture above?

            • 3. Re: Combobox1 + Combobox2 = Textfield1 - fillable pdf
              sp3shalpdfs Level 1

              ok i figured it out with custom validation:

               

              // Define the orange color

              color.orange = ["RGB", 1, .33, 0];

              if (event.value=="Low (4)") event.target.fillColor = color.green;

              else if (event.value=="Low (4)") event.target.fillColor = color.green;

              else if (event.value=="Low (8)") event.target.fillColor = color.green;

              else if (event.value=="Low (12)") event.target.fillColor = color.green;

              else if (event.value=="Low (16)") event.target.fillColor = color.green;

              else if (event.value=="Low (20)") event.target.fillColor = color.green;

              else if (event.value=="Low (24)") event.target.fillColor = color.green;

              else if (event.value=="Low (28)") event.target.fillColor = color.green;

              else if (event.value=="Low (32)") event.target.fillColor = color.green;

              else if (event.value=="Low (36)") event.target.fillColor = color.green;

              else if (event.value=="Low (60)") event.target.fillColor = color.green;

              else if (event.value=="Medium (40)") event.target.fillColor = color.yellow;

              else if (event.value=="Medium (44)") event.target.fillColor = color.yellow;

              else if (event.value=="Medium (52)") event.target.fillColor = color.yellow;

              else if (event.value=="Medium (64)") event.target.fillColor = color.yellow;

              else if (event.value=="Medium (68)") event.target.fillColor = color.yellow;

              else if (event.value=="High (48)") event.target.fillColor = color.orange;

              else if (event.value=="High (56)") event.target.fillColor = color.orange;

              else if (event.value=="High (76)") event.target.fillColor = color.orange;

              else if (event.value=="High (88)") event.target.fillColor = color.orange;

              else if (event.value=="Critical (72)") event.target.fillColor = color.red;

              else if (event.value=="Critical (80)") event.target.fillColor = color.red;

              else if (event.value=="Critical (92)") event.target.fillColor = color.red;

              else if (event.value=="Critical (84)") event.target.fillColor = color.red;

              else if (event.value=="Critical (96)") event.target.fillColor = color.red;

              else if (event.value=="Critical (100)") event.target.fillColor = color.red;

              else event.target.fillColor = color.white;

              if (event.value=="Low (4)") event.target.fillColor = color.green;

              else if (event.value=="Low (4)") event.target.fillColor = color.green;

              else if (event.value=="Low (8)") event.target.fillColor = color.green;

              else if (event.value=="Low (12)") event.target.fillColor = color.green;

              else if (event.value=="Low (16)") event.target.fillColor = color.green;

              else if (event.value=="Low (20)") event.target.fillColor = color.green;

              else if (event.value=="Low (24)") event.target.fillColor = color.green;

              else if (event.value=="Low (28)") event.target.fillColor = color.green;

              else if (event.value=="Low (32)") event.target.fillColor = color.green;

              else if (event.value=="Low (36)") event.target.fillColor = color.green;

              else if (event.value=="Low (60)") event.target.fillColor = color.green;

              else if (event.value=="Medium (40)") event.target.fillColor = color.yellow;

              else if (event.value=="Medium (44)") event.target.fillColor = color.yellow;

              else if (event.value=="Medium (52)") event.target.fillColor = color.yellow;

              else if (event.value=="Medium (64)") event.target.fillColor = color.yellow;

              else if (event.value=="Medium (68)") event.target.fillColor = color.yellow;

              else if (event.value=="High (48)") event.target.fillColor = color.orange;

              else if (event.value=="High (56)") event.target.fillColor = color.orange;

              else if (event.value=="High (76)") event.target.fillColor = color.orange;

              else if (event.value=="High (88)") event.target.fillColor = color.orange;

              else if (event.value=="Critical (72)") event.target.fillColor = color.red;

              else if (event.value=="Critical (80)") event.target.fillColor = color.red;

              else if (event.value=="Critical (92)") event.target.fillColor = color.red;

              else if (event.value=="Critical (84)") event.target.fillColor = color.red;

              else if (event.value=="Critical (96)") event.target.fillColor = color.red;

              else if (event.value=="Critical (100)") event.target.fillColor = color.red;

              else event.target.fillColor = color.white;