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.
Thank you very much, it works! Just one last question: What means |n and |r
Hello @michaelrieder,
The plugin replaces the fields’ names with their values in the equations evaluation process. The |n (Ex. fieldname1|n) tells the plugin you are referring to the field’s name directly instead of its value. Also, the plugin preprocesses the fields’ values to extract numbers (when possible) to use in the mathematical operations. The |r (Ex fieldname1|r) tells the plugin you want to use the raw field’s value without preprocessing.
Best regards.