If else condition help needed

[ad_1]

Hello @asjad492

Thank you very much for using our plugin. You have different alternatives based on your equation’s requirements.

The plugin includes the IF operation. It has the structure IF(condition, result if the condition is true, result if the condition is false). Or, you can use the if conditional statement if(condition){operations if the condition is true} else {operations if the condition is false}

Javascript is a case-sensitive language, please, do not confuse the IF conditional operation with the if conditional statement.

For example, assuming the number field is the fieldname1, and you want to duplicate its value if it is less than 10, or increase it by 5 otherwise.

Insert a calculated field in the form and enter the equation:

IF(fieldname1<10, fieldname1*2, fieldname1+5)

The same equation can be implemented by using function structure and the if conditional statement:

(function(){
if(fieldname1 < 10){return fieldname1*2;}
else {return fieldname1+5;}
})()

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.

Buy WordPress Transfer