﻿
//  When the value in a textfield is changed, notice the onChange...
//  on each of the textfields,  the value of the Record ID associated with that field
//  is passed to the RecUpdate function. First the value is surounded with 2 asterisks e.g. *6*
//  This is so that *1* can be distinguished from *10*, *11* etc.
function RecUpdate(ID){
var ThisID = "*" + (ID) + "*"
if (document.form1.hidIDs.value == ""){	// If the hidden field is empty
document.form1.hidIDs.value = (ThisID)	// Store the value in the hidden field (hidIDs) as it is.
}
if (document.form1.hidIDs.value != ""){  // If the hidden field isn't empty
var str = document.form1.hidIDs.value;	// Store the contents of the hidden field in the variable str
var pos = str.indexOf(ThisID);				// Search str to see if this ID is already in it.
if (pos == -1) {							// If the position returned is -1 it isn't already in there,  
document.form1.hidIDs.value = document.form1.hidIDs.value + ", " + (ThisID)  
} 											// so add ", " and this ID to what is already in hidIDs 
}											// to create a list like this *2*, *5*, *8* etc.	
}
