Displaying the centre value of the Slider at each update

[ad_1]

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.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer