Conditional Formatting | WordPress.org

[ad_1]

Hello @michaelrieder

You can use a calculated field as an auxiliary to modify other background fields at runtime.

Insert a calculated field in the form (you can hide it by ticking a checkbox in its settings) and enter an equation similar to the following one:


(function(){
let color = IF(fieldname1|r == '', 'red', 'white');
getField(fieldname1|n).jQueryRef().css('background', color);
})()

If you want to modify the background color of the input tag in the field instead of the field as a whole, the code would be:


(function(){
let color = IF(fieldname1|r == '', 'red', 'white');
getField(fieldname1|n).jQueryRef().find(':input').css('background', color);
})()

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