Help with Form Calculation

  • qliomaha
    Asked on February 25, 2016 at 1:21 PM

    Hi, we have a form to collect registration and payment for a charitable event.  We would like to be able to send our attendees a charitable receipt immediately following their ticket purchase, so we are trying to figure out a way to code a calculation that produces the deductible amount of their purchase.

     

    It is a fairly straight calculation.

     

    We would like to add a field that computes the amount of their purchase that is not deductible, specifically for our attendees who do not purchase sponsorships.  We will personalize those thank you letters.  Therefore, the calculation is (Quantity of Fair Fun Packs - 8 tickets)*(400) + (Quantity of Tickets Age 21-34)*(50) + (Quantity of Tickets Age 35 and over)*(50).

     

    We will then have a second calculation for the deductible amount of their purchase, which is simply (Total Payment) - (Non Deductible Amount)

     

    We have added a Form Calculation widget to our form, but we are struggling to find a way to focus on the "Quantity" selected for the various ticket options.  We assume this is possible, however, given we have the option to send a specific email to those who use our form based on conditional formatting on the quantity of those values.

     

    Please advise us regarding the easiest way to do this.  Thanks!

  • Ben
    Replied on February 25, 2016 at 3:14 PM

    With conditions you could check out and see if some product was selected or not, but it would not be possible to check with conditions how much of - the quantity - was selected through the same.

    As such it is also not possible to capture the same value in the form calculation. There are only 2 options that would allow you to do this.

    1st - within the form builder

    You could use form fields to allow everyone to purchase what they want allowing you to go into depth with form calculations and do them quite easily as well in the same time.

    Then when you have the total that you want to pass to the payment tool, you just do that and that is it.

    This is the guide that explains this: How to pass a calculation to a payment field

    2nd - out of the form builder

    If you wish to keep the current setup, and do only few modifications to the same, then this would be the only option. It requires you to grab the source code of your form and then add it to your website as such. Once you do, you either do it yourself or hire a developer, but the process would be to create a custom javascript function that would allow you to check the quantity and do the calculation that you then pass to the payment tool.

    The needed guide: How to get the Full Source Code of your Form

    Both would do the job, but I do recommend the first option over the second since in the future it would be much easier to do any changes.