5 Replies Latest reply on Sep 15, 2014 5:10 AM by Test Screen Name

    conditional grand total...stuck




      Would really really appreciate some help with this as I am somewhat stuck.


      I have an order form with individual products, packages and a grand total. The grand total needs to be discounted by either nothing, 5% (if 2 packages are selected) or 10% (if three or more packages are selected).


      I may be over complicating things but what I have done so far is to create two hidden text boxes to make the calculation easier.


      1) a box called "GRAND1" which adds up the quantities of the packages

      2) a box called "GRAND2" which is a hidden grand total adding up all the subtotals


      Finally there is a box called "GRAND" which is the visible grand total box. I thought it might be easier to do it in this way but feel free to correct me.


      As it stand the code I am working with is:


      var x = this.getField("GRAND2").value;

      var y = this.getField("GRAND1");

      if( y = 2 ) event.value = x / 1.05;

      else if( y >= 3 ) event.value = x / 1.10;

      else if( y < 2 ) event.value = x / 1;



      I'd love some help as I really have no idea what I am doing...sorry and thanks in advance