Hi,
The downpayment is an input field, so the users can vary its values like they want. If the minimum value allowed in this field was global (the same minimum value always), the solution is simple, enter the minimum value allowed in the “min” attribute, and that’s all. But unfortunatelly this is not the case, you want a minimum value for each price range and terms selected. I’ll give you a possible solution, but you should adapt it to your equation, if you need a custom equation, you should contact me through the support page:
http://wordpress.dwbooster.com/support
First, you should modify the file: “/wp-content/plugins/calculated-fields-form/js/modules/01_mathematical_logical/public/module_public.js”, to accept textual values in the calculated fields. Follow the steps below:
1. Open the file in the text editor your choice.
2. Go to the snippet of code:
return isFinite( v ) || /\d{2}[\/\-\.]\d{2}[\/\-\.]\d{4}/.test( v );
and edit it like follow:
return typeof v != ‘undefined’;
Now the equation:
Suppose the following conditions: fieldname3 between 5001 and 12000, and fieldname6 equal to 9, the minimum downpayment should be 1000, or with fieldname6 equal to 12 the minimum downpayment should be 2000, or 3000 if fieldname6 is equal to 15. So, the equation would be:
(function(){
var interest = 0;
if(5001<=fieldname3 && fieldname3<=12000)
{
if(fieldname6 == 9){ if(fieldname4 < 1000) return “The minimum downpayment allowed is 1000”; }
else if(fieldname6 == 12){ if(fieldname4 < 2000) return “The minimum downpayment allowed is 2000”; }
else if(fieldname6 == 15){ if(fieldname4 < 3000) return “The minimum downpayment allowed is 3000”; }
}
…..
})()
Replace the ….. by the other conditions and the rest of the equation.
Best regards.