Title: Conditional format for Errors
Last modified: December 5, 2023

---

# Conditional format for Errors

 *  Resolved [andyro](https://wordpress.org/support/users/andyro/)
 * (@andyro)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/conditional-format-for-errors/)
 * I’d like to allow calculations that return a value below a certain threshold 
   ie. 0.15, but if the value is less than the threshold ie. 0.14, a conditional
   formatting rule is applied as a gentle error code… ie. font or cell turns red
   or a text error is thrown that this value is out of range. Is this possible? 
   I am using the dev version.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fconditional-format-for-errors%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/conditional-format-for-errors/#post-17253603)
 * Hello [@andyro](https://wordpress.org/support/users/andyro/),
 * You have multiple alternatives.
 * The easier solution would be to enter 0.15 through the “min” attribute in the
   calculated field’s settings and tick the checkbox “Validate the equation results”.
   The plugin will display the error message if the equation result is lower than
   0.15.
 * Another alternative would be to display the error message directly as part of
   the equations.
 * For example, assuming you have the fieldname1*fieldname2 equation in the calculated
   field fieldname3 and want to display the error text if the equation’s result 
   is lower than 0.15. In this hypothetical equation, you can edit the equation 
   as follows:
 *     ```wp-block-code
       (function(){
       let result = fieldname1*fieldname2;
       return IF(result < 0.15, 'Error Message', result);
       })()
       ```
   
 * You can even modify the field background and color:
 *     ```wp-block-code
       (function(){
       let result = fieldname1*fieldname2, background = 'white', color='#cccc';
   
       if(result < 0.15) {
       background = 'red';
       color = 'white';
       }
   
       getField(fieldname3|n).jQueryRef().find('input').css({'background': background, 'color': color});
   
       return IF(result < 0.15, 'Error Message', result);
       })()
       ```
   
 * Additionally, you can insert an “Instruct. Text” field in the form with the error
   message and configure it as dependent on the calculated field to display it if
   the equation result is lower than 0.15.
 * Best regards.
 *  Thread Starter [andyro](https://wordpress.org/support/users/andyro/)
 * (@andyro)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/conditional-format-for-errors/#post-17253635)
 * amazing, thanks for the prompt response!
 *  Thread Starter [andyro](https://wordpress.org/support/users/andyro/)
 * (@andyro)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/conditional-format-for-errors/#post-17253686)
 * The error is thrown on a readonly field, is it possible to modify the preset 
   warning from ‘Please enter a value greater than or equal to 0.15.’ to ‘Value 
   must be greater than X.XX’? Where does this text reside?
 *  Thread Starter [andyro](https://wordpress.org/support/users/andyro/)
 * (@andyro)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/conditional-format-for-errors/#post-17253689)
 * nevermind – found it!

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

The topic ‘Conditional format for Errors’ 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/)

 * 4 replies
 * 2 participants
 * Last reply from: [andyro](https://wordpress.org/support/users/andyro/)
 * Last activity: [2 years, 5 months ago](https://wordpress.org/support/topic/conditional-format-for-errors/#post-17253689)
 * Status: resolved