• Resolved dareko

    (@dareko)


    Hi, I want to know how many input fields is filled by user. For 4 fields (fieldname2 – fieldname 5) I’ve tried to use the code for calculated field:


    (function() {
    var values = [fieldname2, fieldname3, fieldname4, fieldname5];
    var nonEmptyCount = values.filter(function(val) {
    return val !== ” && val !== null && val !== undefined && !isNaN(val);
    }).length;
    return nonEmptyCount;
    })(


    The returned value is still 4. How should I “clean” these input fields or how to modify function to count them properly?

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author CodePeople2

    (@codepeople2)

    Hello @dareko

    You can check the raw values. The plugin pre-processes the fields’ values to allow using them in mathematical operations. However, when you use the fields’ names in the equations with the |r modifier, you are telling the plugin you want to use fields’ raw values instead of the preprocessed ones:


    (function(){
    var values = [fieldname2|r, fieldname3|r, fieldname4|r, fieldname5|r];
    return values.filter((x) => x !== '').length;
    })()

    The plugin supported modifiers are described in the following section of the plugin documentation:

    https://cff.dwbooster.com/documentation#modifiers

    Best regards.

    Thread Starter dareko

    (@dareko)

    It works perfectly.
    I completely forgot about the |r modifier, which I had already used before 🙂
    Thank you very much for the awsome plugin and support.
    Darek

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Clean/reset values’ is closed to new replies.