Title: Conditional Logic based on other fields
Last modified: July 2, 2020

---

# Conditional Logic based on other fields

 *  Resolved [dragoscristian](https://wordpress.org/support/users/dragoscristian/)
 * (@dragoscristian)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/conditional-logic-based-on-other-fields/)
 * Hello,
 * I am trying to configure a calculator that shows or hides the visibility of a
   field based on the result of another field, not of a fixed value.
 * So for example something like:
 * Field
    Calculations | calculation-2
 * Condition (required)
    Is great
 * Value
    {calculation-1]
 * But that does not seem to work. How can I make the logic work?

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

 *  Plugin Support [Imran – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support9/)
 * (@wpmudev-support9)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/conditional-logic-based-on-other-fields/#post-13063066)
 * Hello [@dragoscristian](https://wordpress.org/support/users/dragoscristian/)
 * I trust you’re doing well!
 * Please let us know more information about the conditions that you wish to use.
 * So if the Calculation value is greater then an X value, you wish to show a Filed
   Y. And if the Calculation value is less then an X value, hide a Y field?
 * In this example I’ve created 3 fields:
    – Number – Calculation – Input
 * The **Input** field needs to be shown if a Number is greater than 10.
 * Edit the Calculation filed, go to Calculation, and add Number field. Please see
   this screenshot:
    [https://take.ms/DIfHv](https://take.ms/DIfHv)
 * Edit the Input field and go to the **Visibility** tab.
    – Add a new rule – Choose**
   Calculation** field from a drop-down – Set **Is Greater** – And add value equal
   to 10
 * Please see this screenshot:
    [https://take.ms/DT4To](https://take.ms/DT4To)
 * This way, when the Number value will have a number greater then 10, an Input 
   field will be shown.
 * Let us know if you have any further questions.
 * Kind regards,
    Nastia
 *  Thread Starter [dragoscristian](https://wordpress.org/support/users/dragoscristian/)
 * (@dragoscristian)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/conditional-logic-based-on-other-fields/#post-13063101)
 * Hello Nastia,
 * thank you for the fast reply!
 * No, this is exactly ehat I don’t want – a fixed number. But a number dependent
   on another field – so a dynamic field.
 * Like this: [https://i.gyazo.com/8bd9cbc040836ed9125049816344b7dc.png](https://i.gyazo.com/8bd9cbc040836ed9125049816344b7dc.png)
 * Fixed values do not help unfortunately…
 *  Plugin Support [Amin – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support2/)
 * (@wpmudev-support2)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/conditional-logic-based-on-other-fields/#post-13072087)
 * Hello [@dragoscristian](https://wordpress.org/support/users/dragoscristian/) ,
 * Sorry for the misunderstanding. So do I understand correctly that you want to
   have actually 2 calculation fields and based on them create conditions?
 * I’ve reached out to the Forminator team to ask if that can be achived like you
   need. We will keep you posted.
 * kind regards,
    Kasia
 *  Plugin Support [Dimitris – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support6/)
 * (@wpmudev-support6)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/conditional-logic-based-on-other-fields/#post-13166757)
 * Hello there [@dragoscristian](https://wordpress.org/support/users/dragoscristian/)
 * As this could get really complicated, our developers created a simple workaround
   by making it specific for the 2 specific calculation fields and one specific 
   role:
 * [https://gist.github.com/wpmudev-sls/b50025b9b2b8faeb75897bbe4395f96](https://gist.github.com/wpmudev-sls/b50025b9b2b8faeb75897bbe4395f96)
 * You can use this as a normal or MU plugin. If you need to change the field IDs
   you can do so in these lines
 *     ```
       let field_1_id = 'calculation-1',
       field_2_id = 'calculation-2';
       ```
   
 * If you need to change the condition you can do so in these lines:
 *     ```
       // Hide calculation-2 field when calculation-2 value is greater than calculation-1 value
       if ( target_value > source_value ) {
         self.hide_field( el );
       } else {
         self.show_field( el );
       }
       ```
   
 * Warm regards,
    Dimitris
 *  Plugin Support [Amin – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support2/)
 * (@wpmudev-support2)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/conditional-logic-based-on-other-fields/#post-13268379)
 * Hello [@dragoscristian](https://wordpress.org/support/users/dragoscristian/) ,
 * We haven’t heard from you for 3 weeks now. We will mark this ticket as resolved
   then. Let us know if you need further assistance.
 * kind regards,
    Kasia

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

The topic ‘Conditional Logic based on other fields’ is closed to new replies.

 * ![](https://ps.w.org/forminator/assets/icon-256x256.gif?rev=3443182)
 * [Forminator Forms – Contact Form, Payment Form & Custom Form Builder](https://wordpress.org/plugins/forminator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/forminator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/forminator/)
 * [Active Topics](https://wordpress.org/support/plugin/forminator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/forminator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/forminator/reviews/)

## Tags

 * [conditional logic](https://wordpress.org/support/topic-tag/conditional-logic/)

 * 5 replies
 * 4 participants
 * Last reply from: [Amin – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support2/)
 * Last activity: [5 years, 10 months ago](https://wordpress.org/support/topic/conditional-logic-based-on-other-fields/#post-13268379)
 * Status: resolved