# How to make automatic calculations using a checkbox?

**rcb2002**Hi... I have a checkbox with 4 items, each one with a value. I linked each of them to textboxes so when I change one of them, the value goes to the empty text box and later, I just sum all the textboxes to get the total. The problem is that I can't automate it, meaning that there is no way to point the main condition to more than one state... because of that, the total does not refresh as it shoud do. Please check the expample in

http://form.jotformz.com/form/41113298100643?

Uncheck the MEALS items and watch what hapens in TOTAL and MT.

And also... I read something in Forum related to a "safe" form (SSH): a secure environment where the user can, for example, type credit card data or personal informations without (or with less) risk to loose this informations to somebody else. Is it true? Can you give me an idea on how to begin?THANK YOU VERY MUCH!

- JotForm Support
**EltonCris**Hi,

Does the M1 M2... text box values are fixed

*(meaning can't be updated by the user)*and should only be taken from the check box? If yes, instead of calculating the text boxes why not calculate the values directly from the check boxes? You can do that by adding the check box field on the calculation formula.This way, when checking/unchecking the check boxes, the total field should update.

Let us know if you have further questions. Thanks!

**rcb2002**Thanks for the prompt answer! Yes, the textboxes values are fixed (they are all $52,00) but I don't know how to use the textbox directly in the calculate field. That's why I used the auxiliar textbox. The used formula was

IF Meals equals "Lunch on 14th - R$ 52,00" insert [52] into M1, and so on... and then I catch the total from those textboxes. I'm sure that I made something wrong so can you help?

Thanks again!...

- JotForm Support
**NeilVicente**Sadly, I couldn't find a way around this for now. It appears like there's a bug though, but we will conduct further tests and let you know of any workaround if there is one.

**rcb2002**Hello, I'm sorry but your colleague said a few lines above that it would be possible... I just didn't understand how to do that. Is there any conflict of informations? Sorry for that!

Thanks again.

- JotForm Support
**Welvin**M1 field = Meals (Lunch on 14th)

M2 field = Meals (Dinner on 14th)

M3 field = Meals (Lunch on 15th)

M4 field = Meals (Lunch on 16th)

Is this correct? If yes, where to put the total calculation? Is it on the CALCULATION field that is currently on your form?

Does

**MT**field stands for**Meals Total**? If yes, it's showing a correct total. Check this screenshot.Which calculation is not working here? Please let us know in full details so we can check this.

Thanks

**rcb2002**Okay, I'll try to explain the operation: The TOTAL field includes the sum of 4 meals (when selected), plus the value of the chosen apartment plus 15% taxes. As I was unable to make the checkboxes meals to lead directly to the total field TOTAL I had to temporarily use the M1 ... M4 fields that receive the values fixed $ 52.00. I put the MT field just to demonstrate the problem: when selected the fields meals (without the rooms), the value should be the TOTAL amount of MT + 15%. To prove this, first uncheck "Lunch on 14th - R $ 52.00" and you will see that in TOTAL is 239.20 and in MT, 208 but when the first checkbox is deselected the values should be updated automatically. I know it must be a logical problem, simple to be solved but have not seen otherwise. I hope you can help me. Thank you again!

- JotForm Support
**ashwin_d**Hello rcb2002,

I did check your form and found several conditions which seems to be confusing since you have added a lot of temp and testing fields.

I have not touched any of your conditions not form fields. I just added one "Form Calculation" widget and added the formula to display the "Total Calculation". The formula is like this:

(r1 * days) + (M1+M2+M3+M4) and also added the 15% of all these to total. Please take a look at the following form and see if this is what you wanted to achieve: http://form.jotformpro.com/form/41311199305953? Feel free to clone this form for a closer look. The following guide should help you in form cloning: http://www.jotform.com/help/42-How-to-Clone-an-Existing-Form-from-a-URL

Do get back to us if you need any other changes. You can delete the "Total" field and also the "Temp", "MT" and "R2" if they are not required. Do get back to us if you want to remove the "M1 to M4" field as well and we will update the "Form Calculation" accordingly.

Thank you!

**rcb2002**Hi ashwin_d, thanks for your help!

The great challenge is that the TOTAL CALCULATION should change WITH the "check or un-check" the MEALS. And as you can see, even if we uncheck the first MEAL (lunch on 14th), your field and my TOTAL (which use almost the same calculation) remain freezed. In fact, all the textboxes below NOTES are TEMP, or will be hidden in the real form. Is all this problem possible to understand? Maybe I'm not being clear... If so, please inform me then I'll try other ways to demonstrate it.

Thanks again

- JotForm Support
**ashwin_d**Hello rcb2002,

I am sorry about that. I was able to figure out the issue. You added condition to add 52 in M1-M4 fields when any of the meals are selected. Now we need to add conditions to check if the M1-M4 is not selected and add value as 0.

I have added the required conditions and the form seems to work as expected. Can you please take a looks at this form and see if this behaves as per your requirement: http://form.jotformpro.com/form/41311199305953?

Do get back to us if you need any other changes.

Thank you!

**rcb2002****Dear ashwin_d,****Yes!! That's what I was talking about! Thank you, very much! Now can you tell me how you made this magic? When I saw the form I counldn't see the conditions...****Thanks again (maybe the last message!)**- JotForm Support
**TitusN**Hello,

That would be rules 15 to 18 that resets the M1 - M4 totals to "0"

You can take a copy of the form and take a closer look.

Let us know if that helps.