Copy link to clipboard
Copied
The two imput boxes are monthly income and # of people. I need to muliply the monthly income by 12 to get the annual. Then i need to take the (number of people - 1) * 5500+15650. Then it needs to divide the annual number/the second equation. Then it needs to be turned into a percentage.
Copy link to clipboard
Copied
Format the field where the solution will appear as a percentage, then enter the following custom calculation script in it:
var income=this.getField("monthly income").value;
var numpeople=this.getField("# of people").value;
if(!income || !numpeople)
{event.value=""}
else
{
event.value=income*12/((numpeople-1)*5500+156540);
}
Copy link to clipboard
Copied
Your field name is monthy income (no L) but the script says monthly income. Ether change the script to say monthy or change the field name to say monthly.
Copy link to clipboard
Copied
Format the field where the solution will appear as a percentage, then enter the following custom calculation script in it:
var income=this.getField("monthly income").value;
var numpeople=this.getField("# of people").value;
if(!income || !numpeople)
{event.value=""}
else
{
event.value=income*12/((numpeople-1)*5500+156540);
}
Copy link to clipboard
Copied
it is giving me syntaxerror: unterminated string literal
2: at line 3
Copy link to clipboard
Copied
Typo. Script corrected.
Copy link to clipboard
Copied
It went through but when i type numbers in the monthly income and # of people it doesn't do anything.
Copy link to clipboard
Copied
Can you upload your form?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Your field name is monthy income (no L) but the script says monthly income. Ether change the script to say monthy or change the field name to say monthly.
Copy link to clipboard
Copied
Thank you, of course it was because I didn't spell it right.
Copy link to clipboard
Copied
Look at the Javascript console (ctrl-j).
Use the correct field names.
Copy link to clipboard
Copied
Are "monthly income" and "# of people" your actual field names?
If not, you need to change them in script to your actual field names.