When you start iterating through your inner query, it "loses its place" in the first query - meaning, referencing a column from the outtermost query and expecting it to know what row it is on. Like referencing query.column outside of a query loop, it defaults to the first row's value. You should save the column value in a local variable before entering the inner query loop:
<cfset thisDecisionID = getReviewers.decisionID> <CFLOOP query="getDCodes"> <option value="#decID#" <CFIF getDCodes.decisionID EQ thisDecisionID>selected</cfif> ----- Original Message ----- From: "Tammy Hong" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Tuesday, January 08, 2002 12:52 PM Subject: problem with dynamic data in my select boxes > Hi everyone, > > Can someone please point to me what the problem here is? I basically have > two queries. One pulls out the record set for a particular ID number and is > grouped in a cfoutput based on another ID number. The problem is that when I > have more than one dynamically populated select box with the HTML below, the > ID that is selected is not the right one. It will select the first > decID of the first reviewer that is outputted. I am sure this is the right > way to reference the variables. Can someone point me to the incorrect logic? > Please! I'm about to pull my hair out. > > > See below: > <CFOUTPUT query="getReviewers" group="reviewerID"> > <select name="decID"> > <option value="0">[Select a decision]</option> > <CFLOOP query="getDCodes"> > <option value="#decID#" <CFIF getDCodes.decisionID EQ > getReviewers.decisionID>selected</cfif> > >#trim(decisionDescription)#</option> > </CFLOOP> > </select> > </CFOUTPUT> > > Tammy > ______________________________________________________________________ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists