18 Replies Latest reply on Aug 4, 2016 6:59 AM by marianne1033

    Trying to make a drop down selection automatically calculate another field, but it is only caclulating one drop down selection

    marianne1033

      I am currently using Acrobat to create a fillable form. Basically I want the selection from the drop down of provinces to calculate the taxes from the SubShip field. I have 3 text fields labelled GST, HST and PST, and the selection should fill out each box respectively. However, with the code I am using now, it is only calculating 13% of the SubShip field no matter which province is selected, and it is only showing in the HST box. Below is my code, and I have no idea where I am going wrong.

      Can someone please help?!?!

       

           var sNewSel = event.value;

           switch (sNewSel) {

             case "Ontario":

               this.getField("HST").value = (this.getField(Subtotal).value +

      this.getField(Shipping).value) *     this.getField("0.13").value;

               this.getField("PST").value = "0";

               this.getField("GST").value = "0";

               break;

      }

       

       

      var sNewSel = event.value;

           switch (sNewSel) {    

           case "Prince Edward Island":

               this.getField("HST").value = this.getField(SubShip).value *     this.getField("0.14").value;

               this.getField("PST").value = "0";

               this.getField("GST").value = "0";

               break;

      }

       

       

      var sNewSel = event.value;

           switch (sNewSel) {

           case "Alberta":

               this.getField("GST").value = this.getField(SubShip).value *     this.getField("0.05").value;

               this.getField("HST").value = "0";

               this.getField("PST").value = "0";

               break;

      }

       

       

      var sNewSel = event.value;

           switch (sNewSel) {

           case "British Columbia":

               this.getField("GST").value = this.getField(SubShip).value *     this.getField("0.05").value;

               this.getField("PST").value = this.getField(SubShip).value *     this.getField("0.07").value;

               this.getField("HST").value = "0";

               break;

       

       

      }

       

       

      var sNewSel = event.value;

           switch (sNewSel) {

           case "Manitoba":

               this.getField("GST").value = this.getField(SubShip).value *     this.getField("0.05").value;

               this.getField("PST").value = this.getField(SubShip).value *     this.getField("0.08").value;

               this.getField("HST").value = "0";

               break;

       

       

      }

       

       

       

       

      var sNewSel = event.value;

           switch (sNewSel) {

           case "New Brunswick":

               this.getField("HST").value = this.getField(SubShip).value *     this.getField("0.13").value;

               this.getField("GST").value = "0";

               this.getField("PST").value = "0";

               break;

       

       

      }

       

       

       

       

      var sNewSel = event.value;

           switch (sNewSel) {

           case "Nova Scotia":

               this.getField("HST").value = this.getField(SubShip).value *     this.getField("0.15").value;

               this.getField("GST").value = "0";

               this.getField("PST").value = "0";

               break;

       

       

      }

       

       

       

       

      var sNewSel = event.value;

           switch (sNewSel) {

           case "Nunavut":

               this.getField("GST").value = this.getField(SubShip).value *     this.getField("0.05").value;

               this.getField("HST").value = "0";

               this.getField("PST").value = "0";

               break;

       

       

      }

       

       

       

       

      var sNewSel = event.value;

           switch (sNewSel) {

           case "Quebec":

               this.getField("PST").value = this.getField(SubShip).value *     this.getField("0.9975").value;

               this.getField("GST").value = this.getField(SubShip).value *     this.getField("0.05").value;

               this.getField("HST").value = "0";

               break;

       

       

      }

       

       

       

       

      var sNewSel = event.value;

           switch (sNewSel) {

           case "Saskatchewan":

               this.getField("GST").value = this.getField(SubShip).value *     this.getField("0.05").value;

               this.getField("PST").value = this.getField(SubShip).value *     this.getField("0.05").value;

               this.getField("HST").value = "0";

               break;

       

       

      }

       

       

       

       

      var sNewSel = event.value;

           switch (sNewSel) {

           case "Yukon":

               this.getField("GST").value = this.getField(SubShip).value *     this.getField("0.05").value;

               this.getField("HST").value = "0";

               this.getField("PST").value = "0";

               break;

       

       

      }

       

       

       

       

      var sNewSel = event.value;

           switch (sNewSel) {

           case "Newfoundland":

               this.getField("HST").value = this.getField(SubShip).value *     this.getField("0.13").value;

               this.getField("GST").value = "0";

               this.getField("PST").value = "0";

               break;

       

       

      }

       

       

       

       

      var sNewSel = event.value;

           switch (sNewSel) {

           case "Northwest Territories":

               this.getField("GST").value = this.getField(SubShip).value *     this.getField("0.05").value;

               this.getField("HST").value = "0";

               this.getField("PST").value = "0";

               break;

       

       

      }