• Resolved waqasazfar

    (@waqasazfar)


    I want to connect slide with another slide,

    like i have 2 slides, i want to change values of slide 2 based on value selected in slide 1.
    for example

    slider one is 1 – 100 values
    i want slider 2 = slider1*10

    so any value selected in slide1, slide should adjust automatically, and vice versa.

    i tried in slider, there is no option to use based on value from another field.
    i tried calculated field, but that is only text, no slider option in calculated field.

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @waqasazfar

    Not exactly, as you want to generate a relationship between two sliders, you need some auxiliary fields. I’ll try to describe the process with a hypothetical example:

    Assuming the slider fields are fieldname1 and fieldname2:

    1. Insert an “HTML Content” field in the form with the following piece of code as its content:

    
    <script>
    var moved = 0;
    jQuery(document).on('slide', '[id*="fieldname1_"].slider', function(){moved = 1;});
    jQuery(document).on('slide', '[id*="fieldname2_"].slider', function(){moved = 2;});
    </script>
    

    2. Insert a calculated field in the form that you can configure as hidden by ticking a checkbox in its settings, with the following equation:

    
    (function(){
    if(moved == 1) getField(2).setVal(fieldname1*10);
    })()
    

    3. Insert another calculated field with the equation:

    
    (function(){
    if(moved == 2) getField(1).setVal(fieldname2/10);
    })()
    

    Best regards.

Viewing 1 replies (of 1 total)

The topic ‘Slider value based on other field’ is closed to new replies.