• Resolved marekurban

    (@marekurban)


    Hey! I would need help with setting the center slider value each time I update / switch to another service:

    I have the following set within the slider – min value is 0, max value is fieldname17, step is fieldname19 – these values change dynamically depending on what service the user selects. E.g. if they choose to sell a property – the slider range will be 0 – 8 000 000 CZK and I need the slider to initially display a value of 4 000 000 CZK. If the user then clicks on e.g. a website, the slider range changes to 0 – 300,000 CZK and I need the slider to show a central value of 150,000 CZK again. Field Caption in Slider is {0} K?. How to achieve this please?

    The page I need help with: [log in to see the link]

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

    (@codepeople)

    Hello @marekurban

    You can insert a calculated field in the form to be used as an auxiliary (you can hide the calculated fields by ticking a checkbox in its settings), and enter an equation similar to the following one:

    For example, assuming the DropDown field is the fieldname1, and it has the choices A, B, and C. Also, you have the slider field fieldname2, and you want to assign the default values based on the following rules.

    If the user selects the choice A, assign the default value 4000000. If the user selects choice B, assign the value 6000000, and finally, if the user selects choice C, assign the 8000000 value to the slider field.

    
    (function(){
    let value;
    if(fieldname1 == 'A') value = 4000000;
    if(fieldname1 == 'B') value = 6000000;
    if(fieldname1 == 'C') value = 8000000;
    
    getField(fieldname2|n).setVal(value);
    })()

    Note I used the |n with fieldname2. The plugin replaces the fields’ names with their values before evaluating the equations. The |n modifier tells the plugin you are referring to the field’s name directly instead of its value.

    Best regards.

    Thread Starter marekurban

    (@marekurban)

    Thanks for the answer. I have added the data below to your equation, pasted it into the Calculated Field, but after running the whole plugin crashes and crashes. So how exactly can I please apply this to make everything work? What do the Slider settings need to be?

    (function(){
    let value;
    if(fieldname2 == “Hypotéka”) value = 4000000;
    if(fieldname2 == “Spot?ebitelsky úvěr”) value = 6000000;
    if(fieldname2 == “Podnikatelsky úvěr”) value = 8000000;
    if(fieldname2 == “úvěr ze stavebního spo?ení”) value = 10000000;

    getField(fieldname18|n).setVal(value);
    })()

    Plugin Author codepeople

    (@codepeople)

    Hello @marekurban

    I visited your webpage, but the form does not include the code that assigns the slider default value.

    Best regards.

    Thread Starter marekurban

    (@marekurban)

    I removed the code because it caused the page to crash every time and thus I wouldn’t have a way to show it to you.

    However, would it be possible to at least somehow easily set the slider to show the value of 10 000 000 CZK when the calculator is first loaded, which is the middle value of the predefined service from the selection that will be shown after the calculator is loaded?

    I want the calculator to show at least some value when it is first loaded and not show zero.

    Thanks a lot!

    Plugin Author codepeople

    (@codepeople)

    Hello @marekurban

    You have configured the Slider max and step attributes variable (based on other fields’ values). When the Slider is generated, the other fields have no values. So, the Slider max is zero, and the plugin cannot assign 10000000 as its default value.

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

    <script>
    fbuilderjQuery(document).on('formReady', function(){
    getField(18).setVal(10000000);
    });
    </script>

    Best regards.

    Thread Starter marekurban

    (@marekurban)

    Thanks a lot! I pasted the code according to your instructions, but still no change happened ?? Could it be a problem in the plugin settings?

    Plugin Author codepeople

    (@codepeople)

    Hello @marekurban

    I checked your form, and you have not applied the recommended code.

    I’m sorry, but if you do not apply the modifications suggested, there is no way we can help you.

    Best regards.

    Thread Starter marekurban

    (@marekurban)

    What do you mean? I inserted the code exactly as you instructed, I am sending a printscreen as proof. https://drive.google.com/file/d/1Ga-ziU6fSAilf92vEHbMfSla_LMOl2A-/view?usp=sharing
    We’re talking about this calculator: [CP_CALCULATED_FIELDS id=”7″]
    You can find it here: https://propojuj.aonity.cz/

    Plugin Author codepeople

    (@codepeople)

    Hello @marekurban

    Your website is loading a cached copy of the form that does not include the code.

    What plugin version are you using? If you have installed an outdated version of the plugin, you should use the showHideDepEvent instead of the formReady:

    <script>
    fbuilderjQuery(document).one('showHideDepEvent', function(){
    getField(18).setVal(10000000);
    });
    </script>

    Best regards.

    Thread Starter marekurban

    (@marekurban)

    Yes, perfect, it works finally! Thank you very much!

    Plugin Author codepeople

    (@codepeople)

    Hello @marekurban

    I see you are using the commercial version of our plugin. We are not allowed to support any customers in these forums.

    For pro or commercial product support please contact us directly on our site. This includes any pre-sales topics as well.

    Commercial products are not supported in these forums. We will happily answer this and any other questions you can have on our own site.

    Thank you.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Displaying the centre value of the Slider at each update’ is closed to new replies.