• Resolved dragoscristian

    (@dragoscristian)


    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)
  • Hello @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

    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

    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

    (@dragoscristian)

    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

    Fixed values do not help unfortunately…

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @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

    (@wpmudev-support6)

    Hello there @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

    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

    (@wpmudev-support2)

    Hello @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.