• Resolved michaelrieder

    (@michaelrieder)


    Hi CodePeople

    is it possible to format field2 (e.g. set background to red) if field1 is empty.

    Best Regards Michael

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    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.

    Thread Starter michaelrieder

    (@michaelrieder)

    Thank you very much, it works! Just one last question: What means |n and |r

    Plugin Author codepeople

    (@codepeople)

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Conditional Formatting’ is closed to new replies.