I've got a popup page where you can edit a lookup that is used on another form below the popup. On my popup page you can add a new item or delete an item from a list of the records in the lookup. The add and delete is two seperate cfforms, with the delete in a cfloop.

I've got a variable of the currently selected id from the parent form hidden on the popup, so that it remembers the selected item when the parent form is refreshed (to show the new lookup item). It works well on the Add new item, but not on the delete, because in the cfloop it only sets the first record to the variable. Any idea how I can set all the items in the loop to the same variable value, or another way of doing this.

Here is the javascript part to set the hidden variable to the value from the parent form. This is run onload:
Code:
function getValues(){
	document.getElementById('tempselCategory').value=opener.document.getElementById('tempselCategory').value;	
			}
And then the deletion part:
Code:
<cfloop query="qrySourceList">
	<tr valign="middle">
		<cfform  action="index.cfm?fuseaction=PMP_PC_CPIs.DeleteLuElements</cfoutput>"
       				method="POST"
	                name="frmDelete"
	                id="frmDelete"
	                onSubmit="tmt_confirm('Delete%20Source?');return document.MM_returnValue">
	<td>									<input name="imageField" type="image" 
				                 src="images/delete_record.gif"
				                 alt="Delete Source"
				                 width="16"
				                 height="16"
				                 border="0"><br>
                     <cfinput type="hidden" name="MM_delete" value="TRUE">		        
<cfinput type="hidden" name="MM_recordId" value="#qrySourceList.SourceID#">
	         <cfinput type="hidden" name="PMP_Mod" value="Source">
	         <cfinput type="hidden" name="tempselCategory" id="tempselCategory"> 
						
		</td>					
</cfform>
   <td align="left"      bgcolor="White"><cfoutput>#qrySourceList.Source#</cfoutput></td>
			</tr>
		</cfloop>
So when I delete the first record it uses tempselCategory, but for any other records tempselCategory is blank.