5 Replies Latest reply on Apr 27, 2015 10:42 PM by kudurider

    Conditional if..else statements populating another field




      new to the forum. A big shout out to all those that help people like me. It is greatly appreciated not only in solving the problem but helping us to learn as well.


      I have looked at other questions and cannot quite get what I am looking for. Java script seems to make my mind go what the...



      I have a credit card form and I want to calculate a surcharge amount on the transaction.

      Type of card (field 'card') is chosen from a dropdown box and the value can either be Visa, MC or Amex, with the export value either 1,2 or 3 respectively.

      The transaction amount is entered into field 'amount'. On Exit of the field 'amount' I want the field 'surcharge' to automatically be populated with a calculation. That calculation being:

      if 'card' = 1 then 'surcharge' = 'amount' * .01


      if 'card' = 2 then 'surcharge' = 'amount' * .03


      if 'card' = 3 then 'surcharge' = 'amount' * .05


      I have one more field 'total' which will be Value of the sum 'amount', 'surcharge'.


      The other part is if the wrong card was chosen first (eg sales person chose Visa but it should have been Amex) I would want the field 'surcharge' to automatically recalculate On Exit of that field.


      Any assistance, guidance would be greatly appreciated.