Display based on calculated values

[ad_1]

Hello @jcollier

You have multiple alternatives to implement the described behavior.

I’ll try to describe the process with a hypothetical example.

Assuming you have three calculated fields, fieldname1, fieldname2, and fieldname3.

If fieldname1 has the largest value, you want to display the text:

Answer A. <a href="https://www.yourwebsite.com/page-a">Click Here</a>

If fieldname2 has the largest value, you want to display the text:

Answer B. <a href="https://www.yourwebsite.com/page-b">Click Here</a>

And the text below if the largest value is associated with the fieldname3:

Answer A. <a href="https://www.yourwebsite.com/page-a">Click Here</a>

First, insert an additional calculated field in the form to use as an auxiliary (I’ll assume it is the fieldname4). You can hide it by ticking a checkbox in its settings. And enter the equation:


(function(){
let value = fieldname1;
let result="Answer A. <a href="https://www.yourwebsite.com/page-a">Click Here</a>";

if(value < fieldname2) {
value = fieldname2;
text="Answer B. <a href="https://www.yourwebsite.com/page-b">Click Here</a>";
}

if(value < fieldname3) {
value = fieldname3;
text="Answer C. <a href="https://www.yourwebsite.com/page-c">Click Here</a>";
}

return text;
})()

Finally, insert an “HTML Content” field in the form where display the text, and enter a DIV tag as its content with the data-cff-field attribute to tell the plugin the field whose value you want to display in the tag:

<div data-cff-field="fieldname4"></div>

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