This is that age-old problem of cfloops.

There are two ways of doing it, the easiest of which to remember is simply to 
set a temporary local variable outside the loop to compare

<select name="StatusID_#TaskID#">
  <cfset temp = getTimeLinesRet.Status_ID>
  <cfloop query="getStatusRet">
    <option value="#Status_ID#" 
    <cfif temp IS getStatusRet.Status_ID >Selected</cfif>
    >#Status#</option>
  </cfloop>
</select>

There's another more elegant solution that involves quare brackets and [ ] 
other cool things but I can never remember it.

Mik


At 11:59 AM 3/13/2007, you wrote:
>I have a select list that is embedded into an output query, and the select
>list is using CFLOOP with the query attribute to generate the list. Of
>course on the update I want the select list to select the record that
>matches in the database, but it is not. Using the standard CFIF statement
>like this:
>
><td align="left">
>                        <select name="StatusID_#TaskID#">
>                            <cfloop query="getStatusRet">
>                                <option value="#Status_ID#" <cfif
>getTimeLinesRet.Status_ID IS getStatusRet.Status_ID
>>Selected</cfif>>#Status#</option>
>                            </cfloop>
>                        </select>
>                    </td>
>
>I would expect that since the list is dynamically generated that it should
>still work even though it is in a loop rather than an output query, but it
>does not. Every record has the first item selected even though when I output
>the query in query analyzer it shows that the Status_ID is different for the
>second record. Any assistance would be appreciated.
>
>Bruce
>
>-- 
>Bruce Sorge
>
>"I'm a mawg: half man, half dog. I'm my own best friend!"
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:272544
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to