I have check boxes labled "suc1", "suc2" etc. They are next to Text boxes labled "su1". "su2" etc . At the bottom is a Total Text box. I would like it to sum all of the text boxes that have a check next to them.
This is what I have so far but I am gettin errors. Or maybe I am making this too hard and there is an easier way of getting this done. ANY help is greatly appreciated!
event.value = "";
var sum = 0;
if(this.getField("suc1").value=="Yes”)event.value=
sum += +getField ("su1").value;
if(this.getField("suc2").value=="Yes”)event.value=
sum += +getField (“su2”).value;
if(this.getField("suc3").value=="Yes”)event.value=
sum += +getField (“su3”).value;
if( !NaN(su1))
sum += (0);
Try:
var sum = 0;
for(i = 1; i < 4; i ++) {
if(this.getField("suc" + i ).value !="Off") sum += Nmber(this.getField ("su" + i).value);
}
if(sum == 0) event.value = '';
else event.value = sum;
George Kaiser