i also used the switch function for fieldform cSBP but no return as well

sorry new to coding here.

Also another question, why does the fieldform cAGE has 0 pre-filled. I want to remove that because that field will be used as input for another calculation and I dont want wrong calculation to happen because of that

Hi,

You’ve included many additional “}” symbols, the correct would be:

```
(function(){
if(fieldname3 < 1 && fieldname3 >= 0){
return 0;
}else if(fieldname3 >= 1 && fieldname3 < 50){
return 1;
}else if(fieldname3 >= 50 && fieldname3 < 76){
return 2;
}else if(fieldname3 >= 76 && fieldname3 < 90){
return 3;
}else if(fieldname3 > 90){
return 4;
}
})()
```

About your second question, the calculated fields are pre-filled with zero, because the equations are evaluated by default. You can deactivate the dynamic evaluation of the equations through the “Form Settings” tab, and then, insert a button field in the form, with “Calculate” as the button’s type.

Another solution is to use a conditional statement in the equation for checking if the initial conditions are valids, for example, suppose you have the equation: fieldname1/fieldname2, and you want evaluate the equation if the values of fieldname1 and fieldname2 are different to zero. You simply should modify the equation as follows:

`IF( AND(fieldname1,fieldname2), fieldname1/fieldname2, '' )`

Best regards.

Hi thanks for your fast response. Sorted the 1st problem

zero is a possible entry.

I just dont want the default value to be zero.

Can null and zero be different, not the same value?

i tried to put in if formfieldx is null, return “Please fill in” but didnt work

if i turn off the dynamic evaluation it still doesnt solve the problem of

null =/= 0

i have an “x” field that is not necessary, but feeds into a formula as an addition. Without the “x” field the formula is void, but mathematically it is not because it is just an addition

Hi,

The fields without values are considered as zero to prevent javascript errors, a solution would be assigning class names to the fields, and check them by their class names (the class names are assigned to the fields through the attribute: “Add Css Layout Keywords”).

For example, returning to the previous example, I assign the class name: firstclass to the fieldname1, and secondclass to the fieldname2, and modify the equation as follows:

`IF(AND(jQuery('.firstname input').val() != "", jQuery('.secondname input').val() != ""), fieldname1/fieldname2, '')`

and that’s all.

Hi, sorry I still cant figure it out,

my fieldform that is calculated is this:

fieldname21=

(function(){

if(fieldname19 == 1){

return 1/(1+exp(-((-0.4499)+(0.8085*fieldname20)-(0.0835*fieldname6)-(1.743*fieldname1))));

}else if(fieldname19 == 2){

return 1/(1+exp(-((-2.5355)+(0.9934*fieldname20)-(0.0651*fieldname6)-(1.136*fieldname1))));

}

})()

the fieldform that should if blank, fieldform21 is void, is fieldname6

i tried modifying your equation of

**IF( AND(fieldname1,fieldname2), fieldname1/fieldname2, ” )**

but because i already have an if,if else condition of

**if(fieldname19 == 1){**

return 1/(1+exp(-((-0.4499)+(0.8085*fieldname20)-(0.0835*fieldname6)-(1.743*fieldname1))));

}else if(fieldname19 == 2){

return 1/(1+exp(-((-2.5355)+(0.9934*fieldname20)-(0.0651*fieldname6)-(1.136*fieldname1))));

}

sorry very new

Hi,

To be sure that the fieldname6 field is not blank, follows the steps below:

1. Assign a class name to the fieldname6 field, for example: myclass,

2. Now, modifies the equation as follows:

```
(function(){
if(jQuery('.myclass input').val() == '') return '';
if(fieldname19 == 1){
return 1/(1+exp(-((-0.4499)+(0.8085*fieldname20)-(0.0835*fieldname6)-(1.743*fieldname1))));
}else if(fieldname19 == 2){
return 1/(1+exp(-((-2.5355)+(0.9934*fieldname20)-(0.0651*fieldname6)-(1.136*fieldname1))));
}
})()
```

and that’s all.

The first line into the equation, checks if fieldname6 is empty, in whose case returns an empty text too.

Best regards.