Troubles with IF statements from dropdown meny
-
Hi everyone. Despite being new to the world of creation of websites and wordpress, I have a strong urge to learn more. Right now I am building a website that helps people that are paying to much in rent (in Sweden) to get this money back (100% for free).
Right now I am using CFF to make a short computation for estimating how much money can be vindicated.
There are a few numerical values added, for which the “normal” calculated fields gives me no problems. But I would like an IF-value derived from a dropdown meny (Nej, Delvis, Ja = No, Partially, Yes) for making an addition to the computated return of the numerical forms with a percentage.
Here is the code without the IF statement.
(fieldname2*fieldname6)-(fieldname10*fieldname6)
Where
fieldname2 = any number
fieldname6 = number between 1-12
fieldname10 = any number.This gives me no problems.
Here is the code in which I have added an IF-statement. I am making a misstake here, but my knowledge of JS is still to low to see the problem. The fieldname11 is a dropdownlist of (Nej, Delvis, Ja).
(function(){
if(fieldname11 = ‘Nej’) return
((fieldname2*fieldname6)-(fieldname10*fieldname6));if(fieldname11 = ‘Delvis’) return
((fieldname2*fieldname6)-((fieldname10*fieldname6)*1,05));if(fieldname11 = ‘Ja’) return
((fieldname2*fieldname6)-((fieldname10*fieldname6)*1,1));})();
As you see I would like to multiply the calculated field with 5% if ‘Delvis’, and with 10% if “Ja”.
Where is the problem?
The page I need help with: [log in to see the link]
- The topic ‘Troubles with IF statements from dropdown meny’ is closed to new replies.