SelectAll/DeselectAll for single or multiple values.

Javascript sometimes treats checkbox fields differently if they only have one value. It's treated as an array if multi-values exist and a standard string field if only one exists, thus the method of selecting and deselecting all must account for this. The code below checks the length of the fieldname object. A single value will return false to a length call.

//check that the "ViewForm" exists before proceeding
if (eval(SourceRecords.ViewForm)) {
	var fieldname = SourceRecords.document.ViewForm.$$SelectDoc;
	if (fieldname.length) {
		//has more than one value
		for(i = 0; i < fieldname.length; i ++){
	} else {
		//has only one value

Posted by fbrefere001 on Tuesday January 17, 2006