1 Reply Latest reply on Nov 6, 2014 12:55 AM by try67

    JavaScript and Drop down menu help?

    zukt

      Hi,

       

      I'm having trouble trying to get options in my drop down menu to update in another section. I have the below script in a hidden field and everything seems to be working but it keeps picking up the last line only when doing calculations (i.e 48) when I change it in the drop down menu to say "HBZ-200" which has the value of 200 it is still only picking up the last line and value of 48.

       

      So to put a little perspective on things the below script is in a hidden field called stndwatt, I then want to calculate that in another hidden field called calc which has the following calculations - (Qty3+ballconsump)-stndwatt, this should then update my visible field called ElectYear1 which then has the calculations of - (Qty1+Qty2)*(Qty4*Qty5*Qtycost*calcs*weeksinyear)/1000, as far as I can work out my stndwatt field is only picking up the last line below which is 48.

       

      I'm sorry if this is vague I'm not very familar with JavaScript or PDF forms and have been scratching my head all day with this.

       

      var v = this.getField("ProductLineOne").value;

      if (v=="T101221W-30 (3000K T10 LED Tube)") event.value = "21";

      else if (v=="T101221W-40 (4000K T10 LED Tube)") event.value = "21";

      else if (v=="T101221W-50 (5000K T10 LED Tube)") event.value = "21";

      else if (v=="T101221W-60 (6000K T10 LED Tube)") event.value = "21";

      else if (v=="HBZ-100 (100W LED High Bay)") event.value = "100";

      else if (v=="HBZ-150 (150W LED High Bay)") event.value = "150";

      else if (v=="HBZ-200 (200W LED High Bay)") event.value = "200";

      else if (v=="ZSL-48W (48W LED Shop Light)") event.value = "48";