Hi @wos2021
I hope you are doing well.
You will need to use the calculation field to get the value, but, I am afraid the calculation doesn’t have a conditional, however, you can create 3 different fields based on the field conditionals.
To find more about the calculation field: https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#calculations-field
Fields conditional: https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#Forminator-Conditional-Logic
Best Regards
Patrick Freitas
Is it possible if you have an example ? I have tried to do this but not succeed.
Big thanks!
Hi @wos2021
One possible way to accomplish this would be with a javascript snippet.
This code reads the value of the first input field on a form, and outputs the cost to the second input field on the form:
<script>
let timer;
const input = document.querySelector('#forminator-field-text-1');
input.addEventListener('keyup', function (e) {
clearTimeout(timer);
var multiplier = 0;
timer = setTimeout(() => {
var amount = input.value;
switch (true) {
case ((amount >= 40) && (amount <= 60)):
multiplier = 10;
break;
case ((amount >= 61) && (amount <= 90)):
multiplier = 20;
break;
case ((amount >= 91) && (amount <= 120)):
multiplier = 30;
break;
}
document.getElementById("forminator-field-text-2").value = multiplier;
}, 1000);
});
</script>
Here’s a gif of how it looks: http://recordit.co/1DoFBvY3rh
You can edit the IDs (#forminator-field-text-1 etc.) as needed for your form.
Here’s a guide on some basic ways to add javascript to your site.
Hope this helped
Hi @aakash8.
This is what I needed! Thanks alot!