# Using Calculate Field to build Ice Calculator form

**bizassist****bizassist**http://www.easyice.com/commercial-ice-machines-ice-usage-estimator/

Here are some calculating details

- JotForm Support
**ardy0689**Thanks for contacting us. I believe that JotForm can do that directly on the Form Builder. All you need is to use the "Calculate Field" on the textboxes. However, there should be a slight difference.

Please click the textboxe where it says Boxes Needed and click the

**Cog/Gear Wheel icon > Calculate Field**This will show you the Calculate Field Wizard where you can put your calculation based on the number of guest textbox

I am not really sure what is your formula so I just came up with just an example to show you. Here is the demo form to show you how the calculation behaves.

http://form.jotform.co/form/33425581882864

If you need further assistance, please do not hesitate to ask. Thank you

- JotForm Support Manager
**Jeanette**I can see you provided some parameters for the calculated form

However, I think the example form Ardy has provided to you is missing the number of Lbs per bag. In order to calculate how many bags an specific industry might need based in the number of persons

**bizassist**http://www.capitalcityice.com/icecalculator.html

Thanks guys. Do you think you can PLEASE start a template for me based on this form in the link above.

I can continue to edit it once I have a few rows created for me. my email is james@bizassist.biz

Once Created I can e-mail you my login info so you can place it in my accout.

Is this possible ?

Kind Regards

James Smolka

- JotForm Support
**ardy0689**Hello James. You may use this demo form and clone it. I have applied the right formula to use. You may see the "Calculate Field" of each field to see their formulas and use it for your pattern.

http://form.jotform.co/form/33425581882864

However, there is just one problem with the implementation. You will going to need to embed this using the form source code as our "

**Calculate Field**" feature does not offer a rounding to the nearest whole number which is required on this specific calculation. For the meantime, please finalize your form while I create the needed script and I will update you here with additional instructions on how to implement it. Thank you - JotForm Support
**ardy0689**In addition to my last reply you may clone the demo form by following this user guide Cloning a Form from a Web Page and clone the demo form I made http://form.jotform.co/form/33425581882864.

In this form there are 2 formulas - one for

**pounds**and 1 for**oz**. The formula is based on the website you just gave. However, the current output for the meantime is wrong as it is not yet rounded upward.You may finalize your form using the 2 formulas in the Calculation fields based on whether it is by pounds or by ounce as you add new rows. Please update us with the final form so that we can implement a script and guide you on the embed. Thank you

**bizassist**Thanks ardy for all your help. I'm still having problems. I used the "Close Option" and it didn't work very well on other forms I've found on the web. It did work for yours.

Existing form is here ..... http://iceboy.ca/ I tried to clone this form and it only brought in a few fields.

Can you Clone this one for me with all the same info ?

Thanks

James

**bizassist**I am re-doing their website and would like to improve this form.

- JotForm Support
**ardy0689**Thanks for replying. I have looked into the website you just shared, it can be done directly from the Form Builder. However, the same issue applies about the rounding. The webpages you shared concerning the formula uses Round() and Ceil() Javascript functions after the calculations are done. We do not offer yet such functions directly from the "Calculate Field" on the builder so we have to improvise and use the form's souce code when embedding the final form and apply the same script that the webpages use manually.

It is just a small script that can be easily inserted. However, the final form should be done in advance to know if we have to adjust some things to be compatible with script.

I will update you here with the cloned form in a short while as it needs some manual placements of the fields as it seems that it does not detect the whole form because its layout.

Thanks

- JotForm Support
**ardy0689**Oops I spoke too soon, I did manage to clone the form from http://iceboy.ca/ but it just uses 1 textbox(Top textbox) as basis for calculation. You can only set 1 calculation per textbox using the

**Calculate field**. It can not be dynamic. As you can see, if you choose any item from the radio buttons it will need to switch the formula on the same textbox. This concept can not be applied on the Calculate Field.Anyway here is the form that I created as per your request:

http://jotformpro.com/form/33466643113956Here is a sample form of it when embedded using the full source code. With the script included. No "Calculation Field" was used from the form Builder.

http://mgtest2013.x10.mx/clients/JotForm/html/answers-300707.html

Download the script here and host it on your server

Embed the location of the script on the head of the HTML file where you pasted the form source code.

<script language="javascript" type="text/javascript" src="//www.yourdomain.com/icecalc1.js"></script>

Find the textbox for the "

**Number of People**" and add this line at the end of the input radio:onfocus="icecalc1('input_4','input_5','input_3','input_1_0','input_1_1','input_1_2')"

That should work. If you are curious about the function. It just gets the ID of the following:

input_4 = ID of 2nd textbox

input_5 = ID of 3rd textbox

input_3 = ID of 1st textbox

input_1_0 = ID of item1 from Events radio button.

input_1_1 = ID of item2 from Events radio button.

input_1_2 = ID of item3 from Events radio button.It needs that ID to look up their values and statuses and based the calculation from user input.

Regards