Title: age calculation default input
Last modified: March 27, 2025

---

# age calculation default input

 *  Resolved [benlashley80](https://wordpress.org/support/users/benlashley80/)
 * (@benlashley80)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/age-calculation-default-input/)
 * hello, I have a field that calculates users age using the following code:
 *     ```wp-block-code
       DATEDIFF(TODAY(), fieldname243 , 'yyyy-mm-dd','y') ['years']
       ```
   
 * this displays -1 before the user selects their birthday. how can I set the calculated
   field to be blank until the birthday is selected? thanks!

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

 *  Plugin Author [CodePeople2](https://wordpress.org/support/users/codepeople2/)
 * (@codepeople2)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/age-calculation-default-input/#post-18386757)
 * Hello [@benlashley80](https://wordpress.org/support/users/benlashley80/)
 * You must ensure the field is not empty before generating the output:
 *     ```wp-block-code
       IF(fieldname243|r, DATEDIFF(TODAY(), fieldname243 , 'yyyy-mm-dd','y') ['years'], '')
       ```
   
 * Best regards.
 *  Thread Starter [benlashley80](https://wordpress.org/support/users/benlashley80/)
 * (@benlashley80)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/age-calculation-default-input/#post-18386784)
 * thank you for the reply!, what is the “| r”?
 *  Plugin Author [CodePeople2](https://wordpress.org/support/users/codepeople2/)
 * (@codepeople2)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/age-calculation-default-input/#post-18386808)
 * Hello [@benlashley80](https://wordpress.org/support/users/benlashley80/)
 * There are no space characters (fieldname243|r). The plugin works as follows:
   
   It takes the equations and replaces the fields’ names with their corresponding
   values, but preprocesses them first to be used in mathematical expressions, etc.
   Additionally, the plugin supports the modifiers (the modifiers modify the plugin’s
   default behavior). Currently, there are three modifiers:
 * `|r` allows you to access the raw field’s value, without preprocessing, e.g.,
   fieldname243|r
 * `|n` tells the plugin you are referring to the field’s name directly instead 
   of its value, e.g., ACTIVATEFIELD(fieldname1|n);
 * `|v` only supported by radio buttons, checkboxes, and dropdown fields. In these
   controls, you can decide between submitting the choices’ texts or values, the`
   |v` modifier tells the plugin you are referring to the information that would
   be submitted. If you have configured the field to submit the choices’ texts, 
   the fieldname1|v allows you to access the selected choice text from the equation
   instead of its value (by using simply fieldname1, you would be accessing the 
   selected choice’s value).
 * Best regards.

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

The topic ‘age calculation default input’ 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/)

 * 3 replies
 * 2 participants
 * Last reply from: [CodePeople2](https://wordpress.org/support/users/codepeople2/)
 * Last activity: [1 year, 2 months ago](https://wordpress.org/support/topic/age-calculation-default-input/#post-18386808)
 * Status: resolved