Title: Clean/reset values
Last modified: August 4, 2025

---

# Clean/reset values

 *  Resolved [dareko](https://wordpress.org/support/users/dareko/)
 * (@dareko)
 * [10 months, 1 week ago](https://wordpress.org/support/topic/clean-reset-values/)
 * 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](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fclean-reset-values%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [CodePeople2](https://wordpress.org/support/users/codepeople2/)
 * (@codepeople2)
 * [10 months, 1 week ago](https://wordpress.org/support/topic/clean-reset-values/#post-18584342)
 * Hello [@dareko](https://wordpress.org/support/users/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:
 *     ```wp-block-code
       (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](https://cff.dwbooster.com/documentation#modifiers)
 * Best regards.
 *  Thread Starter [dareko](https://wordpress.org/support/users/dareko/)
 * (@dareko)
 * [10 months, 1 week ago](https://wordpress.org/support/topic/clean-reset-values/#post-18584415)
 * 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.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [dareko](https://wordpress.org/support/users/dareko/)
 * Last activity: [10 months, 1 week ago](https://wordpress.org/support/topic/clean-reset-values/#post-18584415)
 * Status: resolved