3 Replies Latest reply on Aug 26, 2014 7:44 AM by robinsalvo

    Need help using drop down list to calculate fields

    robinsalvo

      I am trying to use a drop down list to control how my field calculate. I have events packages that have multiple tiers. For example, Package One has (2) Tiers. Tier 1 costs $16 & Tier 2 costs $20. So based on the number of guests i want to be able to select the tier and it multiply and give me the total cost for the package. Ex: 2 Guests for Tier 1 = $32. Here is the code i have so far, it is placed under the change handler of the drop down list:

       

      var costPerGuest = 16;

      var tier = event.newText;

       

       

      if (tier == "Tier 1"){

        costPerGuest = 16;}

      else if (tier == "Tier 2"){

        costPerGuest = 20;}

      Total.rawValue = String(Guests.rawValue * costPerGuest)

      //Total.rawValue = DropDownList1.rawValue;

       

      What happens is when I run this it will not change unless the number of guests will change. So for the example above, if i switch it to Tier 2 after selecting Tier 1, it will not change my Total from $32 to $40.

       

      Any help would be greatly appreciated.