Thanks for that code, Greg.

While you were working on that, I came up with this:

<select name="city" multiple size="9" class="textinput01">
                                                
        <cfif isDefined("form.fieldnames") and isDefined("session.city")>
                <cfloop index="city" list="#form.city#">
                        <option value="<cfoutput>#city#</cfoutput>" 
style="background-color:#B0E0E6"
selected><cfoutput>#city#</cfoutput></option>
                </cfloop>
        </cfif>
                                                
        <option value="any city">any city</option>
        <cfoutput query="get_cities">
                <option value="#city#">#city# - #num_cities#</option>
        </cfoutput>
                                                        
</select>

It puts my selected cities on top with the regular gray select background color,
then as other selections are made, the selections on top turn light-blue 
(#B0E0E6),
and the new selections are the regular gray backgrounds.

Seems to work well... I'll have to see how users respond to this, however.

> -----Original Message-----
> From: Greg Morphis [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 07, 2008 4:34 PM
> To: CF-Talk
> Subject: Re: Is there a way to do this?
> 
> You could
> <cfparam name="form.city" default="0" />
> select distinct city from properties where lower(city) !=
> '#lcase(form.city)#' -- USE <CFQUERYPARAM :)
> 
> then
> <select name="city" multiple="true" size="5">
> <option value="0" <cfif form.city eq 0>selected</cfif>> -- select a
> city --</option>
> <cfoutput query="cities">
> ....
> ....
> </cfoutput>
> </select>
> 
> This would put the selected city at the top
> 
> But then again you could use the union
> select city, orderby from (
> select city, 1 as orderby
> from properties where city = form.city
> union
> select city 2 as orderby
> from properties where city != form.city
> ) order by orderby, city
> 
> That would place your city at top
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308703
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