Hello @smopuim
Thank you very much for using our plugin.
I’ll try to describe the process with a hypothetical example.
Suppose you have two sliding fields, fieldname1, and fieldname2, whose values range from 0 to 100, and you want to ensure that their sum is 100.
Insert an “HTML Content” field in the form with the following piece of code:
<script>
jQuery(document).on('change', '[id*="fieldname1_"]', function(){
var v = this.value;
getField('fieldname2').setVal(100-v, true);
});
jQuery(document).on('change', '[id*="fieldname2_"]', function(){
var v = this.value;
getField('fieldname1').setVal(100-v, true);
});
</script>
Best regards.
Thanks! Everything worked out! And how to get values from other fields in order to correctly set the dependence of the slider movement. That is where var v = this.value; is defined; you need to set more (rather it is not correct, but for example) var d = getField(‘fieldname25’).val()
When I move the slider of field 1, the slider of field 2 moves, but this value is not taken into account in calculations in other fields until I move the slider of field 2.
Hello @smopuim
You can trigger the evaluation of the equations after assigning the slider values. Continuing with the previous example:
<script>
jQuery(document).on('change', '[id*="fieldname1_"]', function(){
var v = this.value;
getField('fieldname2').setVal(100-v, true);
EVALEQUATIONS(this.form);
});
jQuery(document).on('change', '[id*="fieldname2_"]', function(){
var v = this.value;
getField('fieldname1').setVal(100-v, true);
EVALEQUATIONS(this.form);
});
</script>
Best regards.
Everything worked out great! Also, I asked this above:
How to get values from other fields in order to correctly set the dependence of the slider movement. That is where var v = this.value; is defined; you need to set more (rather it is not correct, but for example) var d = getField(‘fieldname25’).val()
Hello @smopuim
I’m not sure about your request. But if you are trying to get the value of a third-party field into the “HTML Content” code, your assumption is correct. You should use a code similar to:
var d = getField('fieldname25').val();
Best regards.