Conditional format for Errors | WordPress.org

[ad_1]

Hello @andyro,

You have multiple alternatives.

The easier solution would be to enter 0.15 through the “min” attribute in the calculated field’s settings and tick the checkbox “Validate the equation results”. The plugin will display the error message if the equation result is lower than 0.15.

Another alternative would be to display the error message directly as part of the equations.

For example, assuming you have the fieldname1*fieldname2 equation in the calculated field fieldname3 and want to display the error text if the equation’s result is lower than 0.15. In this hypothetical equation, you can edit the equation as follows:

(function(){
let result = fieldname1*fieldname2;
return IF(result < 0.15, 'Error Message', result);
})()

You can even modify the field background and color:

(function(){
let result = fieldname1*fieldname2, background = 'white', color="#cccc";

if(result < 0.15) {
background = 'red';
color="white";
}

getField(fieldname3|n).jQueryRef().find('input').css({'background': background, 'color': color});

return IF(result < 0.15, 'Error Message', result);
})()

Additionally, you can insert an “Instruct. Text” field in the form with the error message and configure it as dependent on the calculated field to display it if the equation result is lower than 0.15.

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