Is there a way to do this?

View: New views
16 Messages — Rating Filter:   Alert me  

Is there a way to do this?

by Rick Faircloth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, all...

I'm using a dynamically populated select (multiple)
allowing users to select one or more cities for which
they'd like to view properties.

When the form which contains the form is submitted, it
submits back to the same page it's on.

What I'd like to have happen in the select is for the
first selection to appear at the top of the select choices.

e.g.

First Population of Select:

- any city
- Athens
- Atlanta
- Albany
- Augusta
- etc.

User chooses "Albany".

Select reappears:

- Albany
- Augusta
- etc.

Any way to control this with CF or otherwise?

Thanks,

Rick




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:308675
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: Is there a way to do this?

by Charlie Griefer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

something like:

<select name="city">
     <option value="#cityID#"<cfif form.city is cityID>
selected="selected"</cfif>>#city#</option>
</select>

you'll probably have to throw a <cfparam name="form.city" default=""
/> out there for the initial form display.

getting the 2nd <select> to display the appropriate cities will be a
bit more work, and the answer will depend on how you're currently
doing it.  If it's javascript, you'll need to invoke the javascript
function manually.  something like:

<cfif structKeyExists(form, 'city')>
     <cfoutput><script
type="text/javascript">populateAreas('#form.city#');</script></cfoutput>
</cfif>

But the short answer is... yes.  there is a way to do this :)

On Mon, Jul 7, 2008 at 11:24 AM, Rick Faircloth
<Rick@...> wrote:

> Hi, all...
>
> I'm using a dynamically populated select (multiple)
> allowing users to select one or more cities for which
> they'd like to view properties.
>
> When the form which contains the form is submitted, it
> submits back to the same page it's on.
>
> What I'd like to have happen in the select is for the
> first selection to appear at the top of the select choices.
>
> e.g.
>
> First Population of Select:
>
> - any city
> - Athens
> - Atlanta
> - Albany
> - Augusta
> - etc.
>
> User chooses "Albany".
>
> Select reappears:
>
> - Albany
> - Augusta
> - etc.
>
> Any way to control this with CF or otherwise?
>
> Thanks,
>
> Rick
>
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:308676
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: Is there a way to do this?

by Brian Kotek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This can be done using JavaScript. You can Google for form manipulation code
or check out something like jQuery which would make resorting or modifying
the select box quite simple and wouldn't require a request to the server.

On Mon, Jul 7, 2008 at 2:24 PM, Rick Faircloth <Rick@...>
wrote:

> Hi, all...
>
> I'm using a dynamically populated select (multiple)
> allowing users to select one or more cities for which
> they'd like to view properties.
>
> When the form which contains the form is submitted, it
> submits back to the same page it's on.
>
> What I'd like to have happen in the select is for the
> first selection to appear at the top of the select choices.
>
> e.g.
>
> First Population of Select:
>
> - any city
> - Athens
> - Atlanta
> - Albany
> - Augusta
> - etc.
>
> User chooses "Albany".
>
> Select reappears:
>
> - Albany
> - Augusta
> - etc.
>
> Any way to control this with CF or otherwise?
>
> Thanks,
>
> Rick
>
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:308677
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

RE: Is there a way to do this?

by Rick Faircloth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the replies, Charlie and Brian...

Actually, I should have been more clear.

I've got this code working, which "re-selects" all of the
selected citis:

<cfoutput query="get_cities">
        <cfif (isDefined("form.fieldnames") and isDefined("session.city") and session.city contains
#city#) or session.city is #city#>
                <option value="#city#" selected>#city# - #num_cities#</option>
        <cfelse>
                <option value="#city#">#city# - #num_cities#</option>
        </cfif>
</cfoutput>

What I need now is to get the first selected item to display
at the top of the list.

Will that require javascript?  jQuery, perhaps?

Rick




> -----Original Message-----
> From: Charlie Griefer [mailto:charlie.griefer@...]
> Sent: Monday, July 07, 2008 2:33 PM
> To: CF-Talk
> Subject: Re: Is there a way to do this?
>
> something like:
>
> <select name="city">
>      <option value="#cityID#"<cfif form.city is cityID>
> selected="selected"</cfif>>#city#</option>
> </select>
>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:308679
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: Is there a way to do this?

by Ian Skinner-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Rick Faircloth wrote:

> Thanks for the replies, Charlie and Brian...
>
> Actually, I should have been more clear.
>
> I've got this code working, which "re-selects" all of the
> selected citis:
>
> <cfoutput query="get_cities">
> <cfif (isDefined("form.fieldnames") and isDefined("session.city") and session.city contains
> #city#) or session.city is #city#>
> <option value="#city#" selected>#city# - #num_cities#</option>
> <cfelse>
> <option value="#city#">#city# - #num_cities#</option>
> </cfif>
> </cfoutput>
>
> What I need now is to get the first selected item to display
> at the top of the list.
>
> Will that require javascript?  jQuery, perhaps?
>
> Rick
You could, but if you are building the select in CF as above, just do
something to sort the query into the desired order with the selected
city first.  How this could be done depends on how the data is
organized, but it is 'doable'.




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:308680
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: Is there a way to do this?

by Greg Morphis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You could do something like (not tested)
select distinct city, orderby from (
select city, 2 as orderby
from table
where city < foo_city
union
select city, 1 as orderby
from table
where city >= foo_city
) order by orderby, city

that would tack the prior cities onto the end

On Mon, Jul 7, 2008 at 2:19 PM, Ian Skinner <HOF@...> wrote:

> Rick Faircloth wrote:
>> Thanks for the replies, Charlie and Brian...
>>
>> Actually, I should have been more clear.
>>
>> I've got this code working, which "re-selects" all of the
>> selected citis:
>>
>> <cfoutput query="get_cities">
>>       <cfif (isDefined("form.fieldnames") and isDefined("session.city") and session.city contains
>> #city#) or session.city is #city#>
>>               <option value="#city#" selected>#city# - #num_cities#</option>
>>       <cfelse>
>>               <option value="#city#">#city# - #num_cities#</option>
>>       </cfif>
>> </cfoutput>
>>
>> What I need now is to get the first selected item to display
>> at the top of the list.
>>
>> Will that require javascript?  jQuery, perhaps?
>>
>> Rick
> You could, but if you are building the select in CF as above, just do
> something to sort the query into the desired order with the selected
> city first.  How this could be done depends on how the data is
> organized, but it is 'doable'.
>
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:308683
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

RE: Is there a way to do this?

by Rick Faircloth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well... the cities that populate the multiple select
are returned by a query that provides each distinct city name.

So the cities are not in the db, and all I have to work with
is the name of the city, itself.

I could pull the selected cities "out of the order" and place
them on top of the list, but I'd rather not do that, because
it might confuse the user.

I want the cities to stay in the same order as the query delivers them,
but with the first selected city on the top.

It would be nice if there were some attribute of the select option, like
<option value="#city#" selected top>#city#</option> so I could have that
option with "top" as an attribute "scroll" (not animate) to that point
in the list as the first selection.

I may have to use some jQuery and assign an id to each option dynamically,
then have jQuery find the first selected option and somehow make the
list "scroll" to that point.

Thoughts?

Rick

> -----Original Message-----
> From: Ian Skinner [mailto:HOF@...]
> Sent: Monday, July 07, 2008 3:19 PM
> To: CF-Talk
> Subject: Re: Is there a way to do this?
>
> Rick Faircloth wrote:
> > Thanks for the replies, Charlie and Brian...
> >
> > Actually, I should have been more clear.
> >
> > I've got this code working, which "re-selects" all of the
> > selected citis:
> >
> > <cfoutput query="get_cities">
> > <cfif (isDefined("form.fieldnames") and isDefined("session.city") and session.city contains
> > #city#) or session.city is #city#>
> > <option value="#city#" selected>#city# - #num_cities#</option>
> > <cfelse>
> > <option value="#city#">#city# - #num_cities#</option>
> > </cfif>
> > </cfoutput>
> >
> > What I need now is to get the first selected item to display
> > at the top of the list.
> >
> > Will that require javascript?  jQuery, perhaps?
> >
> > Rick
> You could, but if you are building the select in CF as above, just do
> something to sort the query into the desired order with the selected
> city first.  How this could be done depends on how the data is
> organized, but it is 'doable'.
>
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:308687
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

ONE Ring to Rule them all

by Colman, Richard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 
I maintain 6 - 9 similar CF websites spread across three different
Windows and Linux servers. Maintaining the Application.cfm files is
turning into a big pain.

Is there any practical way to use ONE Application.CFM file in ONE place
for all of these sites?

Rick Colman

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:308688
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

RE: ONE Ring to Rule them all

by Andy Matthews-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Not if you're on different servers.

-----Original Message-----
From: Colman, Richard [mailto:colman@...]
Sent: Monday, July 07, 2008 2:51 PM
To: CF-Talk
Subject: ONE Ring to Rule them all

 
I maintain 6 - 9 similar CF websites spread across three different Windows
and Linux servers. Maintaining the Application.cfm files is turning into a
big pain.

Is there any practical way to use ONE Application.CFM file in ONE place for
all of these sites?

Rick Colman



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:308690
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: ONE Ring to Rule them all

by Barney Boisvert :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Use version control and an automated deployment framework.  You still
have 6-9 copies (can't share across servers), but you can manage them
as one.

cheers,
barneyb

On Mon, Jul 7, 2008 at 12:50 PM, Colman, Richard
<colman@...> wrote:

>
> I maintain 6 - 9 similar CF websites spread across three different
> Windows and Linux servers. Maintaining the Application.cfm files is
> turning into a big pain.
>
> Is there any practical way to use ONE Application.CFM file in ONE place
> for all of these sites?
>
> Rick Colman
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:308691
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: ONE Ring to Rule them all

by Claude Schneegans :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 >>Is there any practical way to use ONE Application.CFM file in ONE place
for all of these sites?

For all my sites, I have a virtual directory on the same "common" directory.
Then for all sites, /common/... refers to the same directory on the server.
In particular, all my Application.cfm start with:
<CFINCLUDE TEMPLATE="/common/applicationCommon.cfm">

And this may be used for many other occasions.

--
_______________________________________
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send any spam to this address: piegeacon@...)
Thanks.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:308692
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: ONE Ring to Rule them all

by Qing Xia :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

One way to do that is to put store your application variables in your SQL
database (or whatever database you use).

That way, in your appication.cfm / application.cfc files, you can do a query
to pull out the values for various application variables such as
file_upload_path, application_home, debug_setting and so forth.  So long as
an application variable used by one web application is defined in the table
for all web applications.

I am sure that is clear as mud. :-)

So, here is an example:

Put the following two blocks of code in your application.cfm /
application.cfc files:

<cfquery name="application.application_wide_variables" datasource="my_dsn">
select application_name, application_home, file_upload_path
from control_center
</cfquery>

<cfset application.application_name =
application.application_wide_variables.application_name>

Just to be sure to set up a data source by the same name (my_dsn in this
example) in all of your applications.  This should work

On Mon, Jul 7, 2008 at 3:54 PM, Andy Matthews <lists@...>
wrote:

> Not if you're on different servers.
>
> -----Original Message-----
> From: Colman, Richard [mailto:colman@...]
> Sent: Monday, July 07, 2008 2:51 PM
> To: CF-Talk
> Subject: ONE Ring to Rule them all
>
>
> I maintain 6 - 9 similar CF websites spread across three different Windows
> and Linux servers. Maintaining the Application.cfm files is turning into a
> big pain.
>
> Is there any practical way to use ONE Application.CFM file in ONE place for
> all of these sites?
>
> Rick Colman
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:308693
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

RE: Is there a way to do this?

by Rick Faircloth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Whoa, that's a dandy little query!

I see you've got "from table"... the cities are
pulled from a properties table via
"select distinct city from properties"

I guess I could use a QoQ in place of the table
as the datasource.

However, you mentioned that your query would
"tack the prior cities onto the end" and I would
prefer to keep the selected cities in the order
they are naturally and reduce the chance of confusing
the user.

It may be that the only way I can do this without jQuery
would be to run a query that returns the names of the
cities selected and then place them on top.  Then run
another query to get all the cities in order.  (Which
seems to be what your single query does, too, Greg).
Usually, I put the selected item in a single select
on top and then list the rest, including the selected
item again after that.

Guess that would work ok.


> -----Original Message-----
> From: Greg Morphis [mailto:gmorphis@...]
> Sent: Monday, July 07, 2008 3:35 PM
> To: CF-Talk
> Subject: Re: Is there a way to do this?
>
> You could do something like (not tested)
> select distinct city, orderby from (
> select city, 2 as orderby
> from table
> where city < foo_city
> union
> select city, 1 as orderby
> from table
> where city >= foo_city
> ) order by orderby, city
>
> that would tack the prior cities onto the end
>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:308698
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: Is there a way to do this?

by Ian Skinner-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Rick Faircloth wrote:
> I want the cities to stay in the same order as the query delivers them,
> but with the first selected city on the top.
>
> It would be nice if there were some attribute of the select option, like
> <option value="#city#" selected top>#city#</option> so I could have that
> option with "top" as an attribute "scroll" (not animate) to that point
> in the list as the first selection.

This is the behavior of any HTML Select control I have ever created with
an element defined as 'selected'.  As long as there where enough options
below the selected element to fill the area of the select control.

This not how it works for you?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:308699
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: Is there a way to do this?

by Greg Morphis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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



On Mon, Jul 7, 2008 at 3:22 PM, Rick Faircloth <Rick@...> wrote:

> Whoa, that's a dandy little query!
>
> I see you've got "from table"... the cities are
> pulled from a properties table via
> "select distinct city from properties"
>
> I guess I could use a QoQ in place of the table
> as the datasource.
>
> However, you mentioned that your query would
> "tack the prior cities onto the end" and I would
> prefer to keep the selected cities in the order
> they are naturally and reduce the chance of confusing
> the user.
>
> It may be that the only way I can do this without jQuery
> would be to run a query that returns the names of the
> cities selected and then place them on top.  Then run
> another query to get all the cities in order.  (Which
> seems to be what your single query does, too, Greg).
> Usually, I put the selected item in a single select
> on top and then list the rest, including the selected
> item again after that.
>
> Guess that would work ok.
>
>
>> -----Original Message-----
>> From: Greg Morphis [mailto:gmorphis@...]
>> Sent: Monday, July 07, 2008 3:35 PM
>> To: CF-Talk
>> Subject: Re: Is there a way to do this?
>>
>> You could do something like (not tested)
>> select distinct city, orderby from (
>> select city, 2 as orderby
>> from table
>> where city < foo_city
>> union
>> select city, 1 as orderby
>> from table
>> where city >= foo_city
>> ) order by orderby, city
>>
>> that would tack the prior cities onto the end
>>
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:308701
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

RE: Is there a way to do this?

by Rick Faircloth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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:gmorphis@...]
> 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=17837.14401.4
LightInTheBox - Buy quality products at wholesale price