Create Scorecard using multiple if / else if / else if statements, and add points
I am attempting to create a fill-in PDF form that is a scorecard. Points values are assigned based on what the user selects from a drop down list. I have the individual points working, however, there are a lot of Syntax Errors. Also, I cannot figure out how to add all the different values together. I have tried simply making the total a calculated field that is simply the sum of the fields picked from the list, but it just shows as zero. I have confirmed the calculation order and the total is listed last, but still no success.
Here are a few examples and the javascript used:
I have ResidenceStatus as a drop down field with the choices below. This is the javascript from the ResidenceStatusScore field:
var ResidenceStatus = this.getField("ResidenceStatus").value;
if (ResidenceStatus=="Owns/Buying") event.value = "55";
else if (ResidenceStatus=="Rents") event.value = "40";
else if (ResidenceStatus=="Other") event.value = "30";
else if (ResidenceStatus==" ") event.value = "0"
I also have an Account field as a drop down with the choices below. Here is the javascript for the AccountScore:
var Account = this.getField("Account").value;
if (Account=="Checking AND Savings") event.value = "44";
else if (Account=="Checking Only") event.value = "35";
else if (Account=="Savings Only") event.value = "30";
else if (Account=="None") event.value = "25";
else if (Account==" ") event.value = "0"
The individual score fields work as expected and change appropriately if the user changes their selection from the drop down, however, I need a total score that adds these individual scores together.
I have turned on Debugger, but here are all the errors I am getting:
SyntaxError: syntax error
1:
SyntaxError: missing : after property id
5:
SyntaxError: missing : after property id
4:
SyntaxError: syntax error
4:
SyntaxError: syntax error
1:Console:Exec
undefined
SyntaxError: syntax error
1:Console:Exec
undefined
SyntaxError: syntax error
5:
SyntaxError: syntax error
5:
SyntaxError: syntax error
5:
TypeError: f is null
1051:byteCodeTool
TypeError: f is null
1051:byteCodeTool
TypeError: f is null
1051:byteCodeTool
TypeError: f is null
1051:byteCodeTool
Also, I can't get the fields to sum for the total.
Any help would be most appreciated!!
