Text parsed as number | WordPress.org

[ad_1]

Hello @gordchan

Thank you very much for using our plugin. Yes, that’s possible. I’ll try to describe the process with a hypothetical example.

Assuming you have the equation fieldname1+fieldname2, and you want to returns the numeric result for values lower than or equal to 10, and the text “More than 10 months” otherwise. Additionally, you want to disable the fields fieldname3 and fieldname4 if the result of the mathematical operation is over 10.

You can implement this process from the equation as follows:

(function(){
var result = fieldname1+fieldname2;
if(result <= 10){
   ACTIVATEFIELD(fieldname3|n);
   ACTIVATEFIELD(fieldname4|n);
   return result; 
}

IGNOREFIELD(fieldname3|n);
IGNOREFIELD(fieldname4|n);
return 'More than 10 months';
})()

Note the use of the |n modifier in fieldname3|n and fieldname4|n. The plugin replaces the field names in the equations by their respective values before evaluation to apply the mathematical operations (fieldname1+fieldname2). The |n modifier tells the plugin you are referring to the field’s name directly, not its value.

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