# Apply a discount on calculation field and pass it on payment field

**lawlibne**Hello,

I am having two problems with the same calculation in the form at https://www.jotform.us/form/62636186333155.

The first problem is that the form requires me to tab through/click on all the options in the calculation before it will calculate the total correctly. For example, if I want to register one attendee from each of the first two fields but no others, I am forced to either tab through the last option or click on the last option before it will render the calculated value.

The second problem is that I cannot figure out how to nest the formulas to achieve a discount. I know I can do this on the Paypal payment, but I need to provide the option to pay by check.

The form text shows that we want to comp the first sponsor registration, but any registrations beyond that first one should be full priced. Every time I try to put this into a nested calculation, the form throws out my entire calculation.

Please advise.

- JotForm Support
**liyam**Hello,

Although there is a default value set, the field is not getting the actual value for the field, unless the focus of the cursor is set to it. To resolve this, you can set URL parameters for its value by doing this:

For your discount concern, can you tell us where this discount shall be sourced from or if this is a static value?

Looking forward to your response.

Thanks.

**lawlibne**Hello,

Can I include those parameters in the embed code for the form?

As for the discount, it is a static value (40) to be applied once t a sponsor registration. If a sponsor registers more than one person, only the first one would be free, the remaining registrations would be at 40 each.

Thank you.

- JotForm Support
**Rose**Thank you for contacting us.

Can I include those parameters in the embed code for the form?

I do not clearly understanding this question. Could you please explain it a bit more clearly?

Regarding discounted calculation, it is an if condition actually and you can configure it by using our conditional logic.

Below document is a detailed guidance about how conditional logic works, which conditions you can use and how to configure each condition.

https://www.jotform.com/help/57-Smart-Forms-Using-Conditional-Logic

However, If you will be stuck somewhere or need our help for any issue, please let us know. We would be pleased to help you. **lawlibne**I think I figured out the first piece (Can I include those parameters in the embed code for the form?). The answer is yes, I can add the parameters you suggested to the embed code so that the form works correctly when embedded.

(parameters = ?activeMembers77=0&retiredstudentMembers80=0&speakers0=0&sponsorsfirst84=0)

As for the conditional logic for the calculation, I still cannot make it work properly. I tried three variations, none of which worked:

If sponsors = 1 DO -40 from Total Due

If sponsors > 1 DO -40 from Total Due

If sponsors < 2 DO -40 from Total Due

All of these variations result in an incorrect value for Total Due.

I'm stumped.

- JotForm Support
**liyam**Hello,

Your calculation starts to become confusing since you have calculations on conditions and you have calculations on your widget. I'm having difficulty figuring out your ideal formula.

Can you explain in detail what you need to do and the computation of your values?

In my opinion, I recommend to clear out your calculations on your widgets first as it seems to be mixing up with the results from the condition.

**lawlibne**Hi there,

There are three types of registrants for our event: active members @ $40, retired/student members @ $20, and sponsors @ $40.

A company or institution may have two types of registrants from the three, so all of the options have to be there.

The wrinkle is that the sponsors get 1 free registration and pay $40 per registrant thereafter.

The total due has to be able to grab the totals from the three types of registrants and deduct $40, IF there is a sponsor among the registrants. While the Paypal widget can have a coupon code that works exactly as intended, I need to offer the option to pay by check or credit card, but still have the $40 discount for the sponsors.

I have now deleted the condition that I was trying to use to deduct the $40 if there are 1 or more sponsor registrants.

Thank you for your help.

- JotForm Support
**EltonCris**Uncheck the following option in the calculation wizard so the calculation updates automatically without waiting for the rest of the blank fields that are part of the formula.

---

With regards to applying a discount, (1 free sponsor $40 for more than 1 sponsors), I suggest adding final calculation field in your form and use it as the output field on conditions.

Example:

1. Add a final calculation field and make sure it does not have a formula in it.

2 .Create an Update/Calculate condition like the following.

If Sponsors is Greater than 1, subtract total amount with 40 and output it on final total calculation field.

Then use the final calculation field in your Payment Field.

If you need further assistance, let us know.

**lawlibne**THANK YOU! That did the trick, although it required several conditional statements to work.You guys rock!!!

- JotForm Support
**liyam**Thank you for keeping us posted, lawlibne. I'm glad Elton's solution worked for you!

If you have other questions, please let us know.

Thanks.