Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm creating a form and almost done. I need to have a totals items entered field at the bottom of a column and can't figure out how to write the Java script for this.
Help please?

If the field is blank, it should be 0 if any one of the other 4 drop down items are selected, it's value should be one with a total possible of 20.

What I have tried:

Found this and tried it but I'm getting a syntax error at Line 3

var total = 0;  
for (var i=1; i<=20; i++) 
{  for var f = this.getField "Type 1", "Type 2", "Type 3", "Type 4", Type 5", "Type 6", "Type 7", "Type 8" "Type 9", "Type 10", "Type 11", "Type 12", "Type 13", "Type 14", "Type 15", "Type 16", "Type 17", Type 18", "Type 19", "Type 20."+i);  
    if (f.valueAsString!="  ". && f.valueAsString!="Met", "FSBO","Exp."+i) total++;  }  
event.value = total;  
Posted
Updated 18-Apr-18 10:03am
v2
Comments
Richard MacCutchan 18-Apr-18 12:10pm    
Line 3 does not look like valid Java or Javascript.

1 solution

So how would I correct that where I'm telling it if the type # field is anything other than blank, count a 1
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900