# Calculator is not loading

Are you experiencing users being unable to see the calculator on the page?

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2FpwQdwbLyCpFl0lkOGZxP%2FPreloader%20default.gif?alt=media&#x26;token=bf284c5d-fe5e-4e50-b78a-99150ab7d4ce" alt=""><figcaption></figcaption></figure>

This is a very common issue that is most likely related to the following reasons:

* Formula field contains non-existing element.
* Formula field contains not logical calculations.
* Incorrect usage of the if/else statements in Formula field.

### Formula field contains non-existing element.

&#x20;the Formula field which is used on your calculator. The fastest way to rule this issue out is to check the console using [Browser developer tools](https://developer.chrome.com/docs/devtools/open/).

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2Fh64E5lMsZ106EpJi6yks%2FCCBN%20console%20error.png?alt=media&#x26;token=1e89bd72-f544-4879-8473-30f16f69238d" alt=""><figcaption></figcaption></figure>

In our example calculator is searching for quantity\_field\_id\_10, but it does not exist. To make sure let's check your Formula field and used elements:

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2FaukcK1wrEmSc6rwylHlq%2FCCBN%20incorrect%20formula.png?alt=media&#x26;token=1ddbb659-8e2b-4159-8f50-a0261ee2b781" alt=""><figcaption></figcaption></figure>

While checking the formula field you can see there is an incorrect element used. After removing or adding new elements into pre-built calculators, use correct calculations in the [Formula field](https://docs.stylemixthemes.com/cost-calculator-builder/calculator-elements/total).&#x20;

### Incorrect usage of the if/else statements in Formula field

While adding a conditional statement in the format of JavaScript code make sure that you followed JavaScript Standard and validated before directly pasting it to the Formula filed. When if/else statements are not finished the Calculator may stop loading on the Page. Here is an example:

{% tabs %}
{% tab title="Incorrect Statement" %}

````
```javascript
if (radio_field_id_2 == 30) {
    if (dropDown_field_id_1 == 1) {
        50 + radio_field_id_2 +  toggle_field_id_8 
    } else if (dropDown_field_id_1 == 2) {
        100 + radio_field_id_2 +  toggle_field_id_8 
    } else if (dropDown_field_id_1 == 3) {
        150 + radio_field_id_2 +  toggle_field_id_8 
    } else {
        180 + radio_field_id_2 +  toggle_field_id_8 
    }
} else {
    if (dropDown_field_id_1 == 1) {
        10 +  toggle_field_id_8 
    } else if (dropDown_field_id_1 == 2) {
        20 +  toggle_field_id_8 
    } else if (dropDown_field_id_1 == 3) {
        30 +  toggle_field_id_8 
    } else if (dropDown_field_id_1 >= 3){
        40 +  toggle_field_id_8 
    }
}
```
````

The if/else statement is wrong in this example because it is ending with "**else if"** in the else part of the snippet.
{% endtab %}

{% tab title="Correct Statement" %}

````
```javascript
if (radio_field_id_2 == 30) {
    if (dropDown_field_id_1 == 1) {
        50 + radio_field_id_2 +  toggle_field_id_8 
    } else if (dropDown_field_id_1 == 2) {
        100 + radio_field_id_2 +  toggle_field_id_8 
    } else if (dropDown_field_id_1 == 3) {
        150 + radio_field_id_2 +  toggle_field_id_8 
    } else {
        180 + radio_field_id_2 +  toggle_field_id_8 
    }
} else {
    if (dropDown_field_id_1 == 1) {
        10 +  toggle_field_id_8 
    } else if (dropDown_field_id_1 == 2) {
        20 +  toggle_field_id_8 
    } else if (dropDown_field_id_1 == 3) {
        30 +  toggle_field_id_8 
    } else {
        40 +  toggle_field_id_8 
    }
}
```
````

The if/else statement is correct in this example because it is ending with "**else**" in all parts of the snippet.
{% endtab %}
{% endtabs %}
