Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

Need Help With Check Box count Script

$
0
0

Need to count the number of checked boxes. I'm using the script below and its not working. What I'm I doing wrong? It's driving me crazy.

 

/*

// document level function to sum named fields

function Sum(aFieldNames) {

var sum = 0; // sum of values

// loop through fields

for (var i = 0; i < aFieldNames.length; i++) {

if(!isNaN(this.getField(aFieldNames[i]).value) )

sum += Number(this.getField(aFieldNames[i]).value);

}

return sum;

} // end of Sum function

*/

 

// array of field names sum

var aCheckBox = new Array('Check Box5', 'Check Box8', 'Check Box11', 'Check Box16', 'Check Box19','Check Box22', 'Check Box25','Check Box28', 'Check Box31', 'Check Box34','Check Box37', 'Check Box40','Check Box43', 'Check Box46', 'Check Box49','Check Box52', 'Check Box55','Check Box58', 'Check Box61', 'Check Box64','Check Box68');

// sum named fields

event.value = Sum(aCheckBox);


Viewing all articles
Browse latest Browse all 12130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>