4 Replies Latest reply on Jan 5, 2010 10:02 AM by richardellis

    Calculating VAT

    richardellis

      I am working on a form that requires calculating the VAT amount.

       

      I have used the following;

       

      var f = this.getField('field1');
      var v = this.getField('checkbox1');
      if(v.value=='Yes')
          var vat = f.value * 0.175;
      else
          var vat = 0;

       

      event.value= f.value * 3 + vat;

       

      But all this is doing is multiplying the pre VAT price by 3 to give the inc VAT price, which is incorrect.

       

      What I actually need is a script that sees the value of a field calculates the VAT and shows the result. Does anyone have any ideas?

       

      Thanks in advance.!