Hello @zduni,
If you are talking about the choices into a checkboxes field, for example the fielname1, the piece of code to use in the equation would be:
(function(){
var total = fieldname1, count = jQuery('[id="fieldname'+'1_"]:checked');
if(5<=count) return total*0.9;
return total;
})()
and that’s all.
Best regards.
Thread Starter
zduni
(@zduni)
what about all fields in the form not only “fieldname1”?
Hello,
Assuming that the list of fields is fieldname1, fieldname2, fieldname3, fieldname4, fieldname5, fieldname6, fieldname7, fieldname8, fieldname9, and fieldname10, and that current equation is the sum of all of them:
fieldname1+fieldname2+fieldname3+fieldname4+fieldname5+fieldname6+fieldname7+fieldname8+fieldname9+fieldname10
In this case the equation can be edited as follows:
(function(){
var total = fieldname1+fieldname2+fieldname3+fieldname4+fieldname5+fieldname6+fieldname7+fieldname8+fieldname9+fieldname10, count=0;
if(fieldname1) count++;
if(fieldname2) count++;
if(fieldname3) count++;
if(fieldname4) count++;
if(fieldname5) count++;
if(fieldname6) count++;
if(fieldname7) count++;
if(fieldname8) count++;
if(fieldname9) count++;
if(fieldname10) count++;
if(5<=count) return total*0.9;
return total;
})()
and that’s all.
If you need additional help implementing your project, I can offer you a custom coding service through my personal website:
https://cff.dwbooster.com/customization
Best regards.
Thread Starter
zduni
(@zduni)
the if(5<=count) seems not to working, give me everytime 100% not 90%. If I for the test write only if(count) than the summe is ok 90%.
Hello,
Please, send me the link to the webpage where the form is inserted, and indicate the name of the calculated field.
Best regards.
Thread Starter
zduni
(@zduni)
Hi, please give me your email.
Hello,
If you prefer, you can create a ticket in my personal website:
https://cff.dwbooster.com/contact-us
Best regards.