Zero is not working | WordPress.org

Hello @bulbuljessore

Thank you very much for using our plugin.

I’m sorry, I don’t understand your question about the equations because the screenshot provided is about dependency rules.

Could you please be more specific?

Best regards.

Ok so if you check the calculator link there is a balloon payment. And I do not want to make it mandatory.

So for example If I do not put any value on that balloon payment it will calculate the monthly and total payment or if I put any value on that balloon payment this will also calculate the value base on that percentage in the balloon payment section.

but currently is not calculating anything if I leave the balloon payment option zero.

I hope that makes seance. Looking forward to hearing from you.

Hello @bulbuljessore

Your “Monthly Payment” equation is:

prec((fieldname2*fieldname7/fieldname14/1200*pow(1+fieldname7/fieldname14/1200,fieldname8)-fieldname6*fieldname7/fieldname14/1200)/(pow(1+fieldname7/fieldname14/1200,fieldname8)-1),2)

You are using fieldname14 as the divisor. In mathematics, the division by zero generates an error. I don’t know the result you want to display when the fieldname14 is empty or zero (mathematically, both situations are considered as zero). You should use conditional statements in the equation to separate both cases:

(function(){
if(fieldname14)
{
return prec((fieldname2*fieldname7/fieldname14/1200*pow(1+fieldname7/fieldname14/1200,fieldname8)-fieldname6*fieldname7/fieldname14/1200)/(pow(1+fieldname7/fieldname14/1200,fieldname8)-1),2); 
}
else return 0;
})()

Best regards.

Thanks, I appreciate it but a little bit confused that where you want me to use these conditional statements.

I mean if you tell me which section I have to put in that will be more helpful for me to fix the problem.

Hello @bulbuljessore

The code I sent you previously corresponds to the equation in the “Monthly Payment” field. You should select the field in the forms builder, and enter the equation through its “Set equation” attribute.

Best regards.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Your Advertisement Here