3 Replies Latest reply on Aug 12, 2016 8:27 AM by gkaiseril

    show different total in same field depending on which radio button is ticked

    C_D_F Level 1

      Hi All,


      Not sure how to search for this question so I'm just going to ask it in a new thread. Please point me to an existing thread if it exists.


      I have a form with 2 line items, each with a qty field:

      Parts: ($ amount) Qty:

      Labour: ($ amount) Qty:



      Parts: $100 Qty: 2

      Labour: $200 Qty: 1

      TOTAL: $400


      I am able to calculate the parts and labour with the use of hidden helper fields with Adobe Acrobats calculations feature via the Calculate Tab in the Text Field Properties box for each field, so the above example would calculate to $400.


      What I can't work out is the user wants 2 radio buttons. 1. GST Inclusive 2. No GST. This is in Australia so GST of 10% gets added to the total if the GST Inclusive button is ticked (above eg would come to $440). If the No GST button is ticked, it's just the normal sum total of Parts & Labour (above eg $400).


      Can someone point me to the right direction of writing some javascript to show the TOTAL field with ($440) or without GST ($400), depending on which radio button is ticked?


      Hidden Helper cells (if this helps) are:

      - PartsTotal (Parts x PartsQty = $200)

      - LabourTotal (Labour x LabourQty = $200)

      - GST_10pc (0.1)

      - TOTAL_NoGST (PartsTotal + Labour Total = $400)

      - TOTAL_GST_Calc (TOTAL_NoGST x GST_10pc = $40)

      - TOTAL_wGST (TOTAL_NoGST + TOTAL_GST_Calc = $440)


      I have no problem with the helper cells calculating the $400 and $440 totals (above) but I don't know how to show either field in the TOTAL Field so that TOTAL shows the contents of either TOTAL_NoGST or TOTAL_wGST.


      In other words an if statement would read:



      GST Inc is ticked, show TOTAL_wGST in TOTAL



      No GST is ticked, show TOTAL_NoGST in TOTAL


      Show a blank field until one of them is ticked (would be a nice addition to the javascript if possible, or I could just make the radio buttons compulsory)


      Hope that's clear.