• Resolved sam3n

    (@sam3n)


    Hello together,

    I am using a slider with a calculated field. I activated the function “Allow to type the values” for the slider. After I tried to use this function for the first time, I realized, that the typed value is shown through the slider but not used for the calculation. The calculation is based on the following code:

    (function(){
        if(fieldname1<101) return fieldname1;
        if(AND(fieldname1>100, fieldname1<201))
        {
            return ((fieldname1-100)*2+100);
        }
        if(AND(fieldname1>200, fieldname1<301))
        {
            return ((fieldname1-200)*3+300);
        }
        if(AND(fieldname1>300, fieldname1<401))
        {
            return ((fieldname1-300)*4+600);
        }
    })();

    Is there any way to solve this problem?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @sam3n

    Please, send me the link to the page where the form is inserted to check the equation in action.

    Best regards.

    Thread Starter sam3n

    (@sam3n)

    Hello @codepeople,

    thank you for the reply. This is the link to the page:
    https://www.mammutbaum-schule.de/preise/
    Maybe you can also identify the problem, that the slider is going back to 60, when you enter a value slowly. I don’t know if this is part of the whole problem.

    Plugin Author codepeople

    (@codepeople)

    Hello @sam3n

    Your form works properly. It updates the slider control and the equation in the onchange event of the associated input box. Please, watch the video visiting the following link:

    https://wordpress.dwbooster.com/customdownloads/2020/09/28/video-slider-o.mp4

    Best regards.

    Thread Starter sam3n

    (@sam3n)

    Hi @codepeople,

    thanks for the video. Yes it works, when you type the numbers fast. But when you type the number a bit slower (what could happen when customers use the slider), it jumps back to 60. From this moment on, the calculation is not working anymore. I also have a video about this but I don’t know, how to add it to this thread. Maybe you could try to type in the number a bit slower and see the problem through that.

    Plugin Author codepeople

    (@codepeople)

    Hello @sam3n

    The solution here would be disabling the slider update on the keyup event of the input box, because the plugin checks the min attribute of the slider, and if the typed value is lower than the “min” attribute, it applies the “min”. And the same happens with the typed value and the “max” attribute.

    Please, insert an “HTML Content” field in the form, and enter the following piece of code as its content:

    
    <script>
    fbuilderjQuery(document).one('showHideDepEvent', function(){
    jQuery('.cff-slider-field [type="number"]').on('keyup', function(evt){evt.stopPropagation();evt.preventDefault();});
    });
    </script>
    

    Best regards.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Typing values for slider stops calculation’ is closed to new replies.